KDE/kdevplatform [POSSIBLY UNSAFE]

Andreas Pakulat apaku at gmx.de
Sun Dec 2 21:53:40 UTC 2007


On 02.12.07 20:19:12, Andreas Pakulat wrote:
> SVN commit 744159 by apaku:
> 
> Changes needed to provide import widget for CVS:
> - import() takes now a VcsMapping+commit message
> - VcsLocation has more extended information for repository locations, like Server,Module,Path,Branch and Tag
> - the import widget allows to disable editing the src location
> - the import widget provides commit message
> 
> CC'ing kdevelop list so we can have a discussion about this change.

And of course the limit for the size of commit-diffs is too low for the
diff again. Attaching the full diff here:

Index: plugins/subversion/kdevsvnplugin.cpp
===================================================================
--- plugins/subversion/kdevsvnplugin.cpp	(Revision 744158)
+++ plugins/subversion/kdevsvnplugin.cpp	(Revision 744159)
@@ -300,9 +300,7 @@
     return 0;
 }
 
-KDevelop::VcsJob* KDevSvnPlugin::import( const KUrl& /*localLocation*/,
-                const QString& /*repositoryLocation*/,
-                KDevelop::IBasicVersionControl::RecursionMode /*recursion*/ )
+KDevelop::VcsJob* KDevSvnPlugin::import( const KDevelop::VcsMapping& localLocation, const QString& commitMessage )
 {
     return 0;
 }
Index: plugins/subversion/svnimportmetadatawidget.h
===================================================================
--- plugins/subversion/svnimportmetadatawidget.h	(Revision 744158)
+++ plugins/subversion/svnimportmetadatawidget.h	(Revision 744159)
@@ -19,6 +19,11 @@
     class SvnImportMetadataWidget;
 }
 
+namespace KDevelop
+{
+class VcsLocation;
+}
+
 class SvnImportMetadataWidget : public KDevelop::VcsImportMetadataWidget
 {
     Q_OBJECT
@@ -26,8 +31,10 @@
     SvnImportMetadataWidget( QWidget *parent );
     virtual ~SvnImportMetadataWidget();
 
-    virtual void setImportDirectory( const QString& );
+    virtual void setSourceLocation( const KDevelop::VcsLocation& );
+    virtual void setSourceLocationEditable( bool );
     virtual KDevelop::VcsMapping mapping() const;
+    virtual QString message() const;
 
 private:
     Ui::SvnImportMetadataWidget *m_ui;
Index: plugins/subversion/svndiffwidget.cpp
===================================================================
--- plugins/subversion/svndiffwidget.cpp	(Revision 744158)
+++ plugins/subversion/svndiffwidget.cpp	(Revision 744159)
@@ -55,7 +55,7 @@
     kDebug(9510) << "diff:" << diff.leftTexts().count();
     foreach( KDevelop::VcsLocation l, diff.leftTexts().keys() )
     {
-        kDebug(9510) << "diff:" << l.localUrl() << l.repositoryLocation();
+        kDebug(9510) << "diff:" << l.localUrl() << l.repositoryServer();
     }
     kDebug(9510) << "diff:" << diff.diff();
     kDebug(9510) << "diff:" << diff.type();
Index: plugins/subversion/svncatjob.cpp
===================================================================
--- plugins/subversion/svncatjob.cpp	(Revision 744158)
+++ plugins/subversion/svncatjob.cpp	(Revision 744159)
@@ -68,7 +68,7 @@
             }
         }else
         {
-            srcba = source().repositoryLocation().toUtf8();
+            srcba = source().repositoryServer().toUtf8();
         }
         svn::Revision srcRev = createSvnCppRevisionFromVcsRevision( srcRevision() );
         content = QString::fromUtf8( cli.cat( svn::Path( srcba.data() ), srcRev ).c_str() );
@@ -76,7 +76,7 @@
     }catch( svn::ClientException ce )
     {
         kDebug(9510) << "Exception while doing a diff: "
-                << m_source.localUrl() << m_source.repositoryLocation() << m_srcRevision.revisionValue()
+                << m_source.localUrl() << m_source.repositoryServer() << m_srcRevision.revisionValue()
                 << QString::fromUtf8( ce.message() );
         setErrorMessage( QString::fromUtf8( ce.message() ) );
         m_success = false;
Index: plugins/subversion/kdevsvnplugin.h
===================================================================
--- plugins/subversion/kdevsvnplugin.h	(Revision 744158)
+++ plugins/subversion/kdevsvnplugin.h	(Revision 744159)
@@ -105,10 +105,7 @@
     KDevelop::VcsJob* resolve( const KUrl::List& localLocations,
                              KDevelop::IBasicVersionControl::RecursionMode recursion );
 
-    KDevelop::VcsJob* import( const KUrl& localLocation,
-                            const QString& repositoryLocation,
-                            KDevelop::IBasicVersionControl::RecursionMode recursion
-                                      = KDevelop::IBasicVersionControl::Recursive );
+    KDevelop::VcsJob* import( const KDevelop::VcsMapping& localLocation, const QString& commitMessage );
 
     KDevelop::VcsJob* checkout( const KDevelop::VcsMapping & mapping );
 
Index: plugins/subversion/svnimportmetadatawidget.cpp
===================================================================
--- plugins/subversion/svnimportmetadatawidget.cpp	(Revision 744158)
+++ plugins/subversion/svnimportmetadatawidget.cpp	(Revision 744159)
@@ -12,12 +12,13 @@
 #include "svnimportmetadatawidget.h"
 #include "ui_importmetadatawidget.h"
 #include <vcsmapping.h>
+#include <vcslocation.h>
 
 SvnImportMetadataWidget::SvnImportMetadataWidget( QWidget *parent )
     : VcsImportMetadataWidget( parent ), m_ui(new Ui::SvnImportMetadataWidget)
 {
     m_ui->setupUi( this );
-    m_ui->srcLabel->setText( "" );
+    m_ui->srcEdit->setUrl( KUrl() );
 }
 
 SvnImportMetadataWidget::~SvnImportMetadataWidget()
@@ -25,17 +26,30 @@
     delete m_ui;
 }
 
-void SvnImportMetadataWidget::setImportDirectory( const QString& importdir )
+void SvnImportMetadataWidget::setSourceLocation( const KDevelop::VcsLocation& importdir )
 {
-    m_ui->srcLabel->setText( importdir );
+    m_ui->srcEdit->setUrl( importdir.localUrl() );
 }
 
 KDevelop::VcsMapping SvnImportMetadataWidget::mapping() const
 {
-    QString importdir = m_ui->srcLabel->text();
+    KDevelop::VcsLocation loc;
+    loc.setLocalUrl( m_ui->srcEdit->url() );
+    KDevelop::VcsLocation destloc;
+    destloc.setRepositoryServer(m_ui->dest->url().url());
     KDevelop::VcsMapping map;
-    map.addMapping( importdir, m_ui->dest->url().url(), m_ui->recursive->isChecked() ? KDevelop::VcsMapping::Recursive : KDevelop::VcsMapping::NonRecursive );
+    map.addMapping( loc, destloc , m_ui->recursive->isChecked() ? KDevelop::VcsMapping::Recursive : KDevelop::VcsMapping::NonRecursive );
     return map;
 }
 
+void SvnImportMetadataWidget::setSourceLocationEditable( bool enable )
+{
+    m_ui->srcEdit->setEnabled( enable );
+}
+
+QString SvnImportMetadataWidget::message() const
+{
+    return m_ui->message->toPlainText();
+}
+
 #include "svnimportmetadatawidget.moc"
Index: plugins/subversion/svndiffjob.cpp
===================================================================
--- plugins/subversion/svndiffjob.cpp	(Revision 744158)
+++ plugins/subversion/svndiffjob.cpp	(Revision 744159)
@@ -78,7 +78,7 @@
                 }
             }else
             {
-                srcba = source().repositoryLocation().toUtf8();
+                srcba = source().repositoryServer().toUtf8();
             }
             QByteArray dstba;
             if( destination().type() == KDevelop::VcsLocation::LocalLocation )
@@ -93,7 +93,7 @@
                 }
             }else
             {
-                dstba = destination().repositoryLocation().toUtf8();
+                dstba = destination().repositoryServer().toUtf8();
             }
             svn::Revision srcRev = createSvnCppRevisionFromVcsRevision( srcRevision() );
             svn::Revision dstRev = createSvnCppRevisionFromVcsRevision( dstRevision() );
@@ -120,7 +120,7 @@
                 }
             }else
             {
-                srcba = source().repositoryLocation().toUtf8();
+                srcba = source().repositoryServer().toUtf8();
             }
             svn::Revision pegRev = createSvnCppRevisionFromVcsRevision( pegRevision() );
             svn::Revision srcRev = createSvnCppRevisionFromVcsRevision( srcRevision() );
@@ -141,8 +141,8 @@
     }catch( svn::ClientException ce )
     {
         kDebug(9510) << "Exception while doing a diff: "
-                << m_source.localUrl() << m_source.repositoryLocation() << m_srcRevision.prettyValue()
-                << m_destination.localUrl() << m_destination.repositoryLocation() << m_dstRevision.prettyValue()
+                << m_source.localUrl() << m_source.repositoryServer() << m_srcRevision.prettyValue()
+                << m_destination.localUrl() << m_destination.repositoryServer() << m_dstRevision.prettyValue()
                 << QString::fromUtf8( ce.message() );
         setErrorMessage( QString::fromUtf8( ce.message() ) );
         m_success = false;
@@ -357,14 +357,14 @@
                 l.setLocalUrl( KUrl( s ) );
             }else
             {
-                QString repoLocation = KUrl( l.repositoryLocation() ).path();
+                QString repoLocation = KUrl( l.repositoryServer() ).path();
                 QFileInfo fi( repoLocation );
                 if( s == fi.fileName() )
                 {
-                    l.setRepositoryLocation( l.repositoryLocation() );
+                    l.setRepositoryServer( l.repositoryServer() );
                 }else
                 {
-                    l.setRepositoryLocation( l.repositoryLocation() + "/" + s );
+                    l.setRepositoryServer( l.repositoryServer() + "/" + s );
                 }
             }
 
Index: plugins/subversion/ui/importmetadatawidget.ui
===================================================================
--- plugins/subversion/ui/importmetadatawidget.ui	(Revision 744158)
+++ plugins/subversion/ui/importmetadatawidget.ui	(Revision 744159)
@@ -6,24 +6,17 @@
     <x>0</x>
     <y>0</y>
     <width>549</width>
-    <height>94</height>
+    <height>280</height>
    </rect>
   </property>
   <layout class="QGridLayout" >
    <item row="0" column="0" >
-    <widget class="QLabel" name="label" >
+    <widget class="QLabel" name="labelForSrc" >
      <property name="text" >
       <string>Source directory:</string>
      </property>
     </widget>
    </item>
-   <item row="0" column="1" >
-    <widget class="QLabel" name="srcLabel" >
-     <property name="text" >
-      <string>TextLabel</string>
-     </property>
-    </widget>
-   </item>
    <item row="1" column="0" >
     <widget class="QLabel" name="label_2" >
      <property name="text" >
@@ -61,10 +54,31 @@
      </property>
     </widget>
    </item>
+   <item row="0" column="1" >
+    <widget class="KUrlRequester" name="srcEdit" />
+   </item>
+   <item row="3" column="1" >
+    <widget class="KTextEdit" name="message" />
+   </item>
+   <item row="3" column="0" >
+    <widget class="QLabel" name="label" >
+     <property name="text" >
+      <string>Commit Message:</string>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+     </property>
+    </widget>
+   </item>
   </layout>
  </widget>
  <customwidgets>
   <customwidget>
+   <class>KTextEdit</class>
+   <extends>QTextEdit</extends>
+   <header>ktextedit.h</header>
+  </customwidget>
+  <customwidget>
    <class>KUrlRequester</class>
    <extends>QFrame</extends>
    <header>kurlrequester.h</header>
Index: plugins/cvs/cvsplugin.cpp
===================================================================
--- plugins/cvs/cvsplugin.cpp	(Revision 744158)
+++ plugins/cvs/cvsplugin.cpp	(Revision 744159)
@@ -575,7 +575,7 @@
     return NULL;
 }
 
-KDevelop::VcsJob * CvsPlugin::import(const KUrl & localLocation, const QString & repositoryLocation, KDevelop::IBasicVersionControl::RecursionMode recursion)
+KDevelop::VcsJob * CvsPlugin::import(const KDevelop::VcsMapping& localLocation, const QString& commitMessage)
 {
     return NULL;
 }
Index: plugins/cvs/cvsplugin.h
===================================================================
--- plugins/cvs/cvsplugin.h	(Revision 744158)
+++ plugins/cvs/cvsplugin.h	(Revision 744159)
@@ -90,9 +90,7 @@
                 const KUrl& localLocation );
     virtual KDevelop::VcsJob* resolve( const KUrl::List& localLocations,
                 KDevelop::IBasicVersionControl::RecursionMode recursion );
-    virtual KDevelop::VcsJob* import( const KUrl& localLocation,
-                const QString& repositoryLocation,
-                KDevelop::IBasicVersionControl::RecursionMode recursion );
+    virtual KDevelop::VcsJob* import( const KDevelop::VcsMapping& localLocation, const QString& commitMessage );
     virtual KDevelop::VcsJob* checkout( const KDevelop::VcsMapping& mapping );
     // End:  KDevelop::IBasicVersionControl
 
Index: vcs/vcsimportmetadatawidget.h
===================================================================
--- vcs/vcsimportmetadatawidget.h	(Revision 744158)
+++ vcs/vcsimportmetadatawidget.h	(Revision 744159)
@@ -28,6 +28,7 @@
 {
 
 class VcsMapping;
+class VcsLocation;
 
 class KDEVPLATFORMVCS_EXPORT VcsImportMetadataWidget : public QWidget
 {
@@ -36,8 +37,10 @@
     VcsImportMetadataWidget( QWidget* parent );
     virtual ~VcsImportMetadataWidget();
     virtual VcsMapping mapping() const = 0;
+    virtual QString message() const = 0;
 public Q_SLOTS:
-    virtual void setImportDirectory( const QString& ) = 0;
+    virtual void setSourceLocation( const VcsLocation& ) = 0;
+    virtual void setSourceLocationEditable( bool ) = 0;
 };
 
 }
Index: vcs/interfaces/ibasicversioncontrol.h
===================================================================
--- vcs/interfaces/ibasicversioncontrol.h	(Revision 744158)
+++ vcs/interfaces/ibasicversioncontrol.h	(Revision 744159)
@@ -266,12 +266,9 @@
      */
 
     /**
-     * take the local directory and add it into the repository at the given
-     * target
+     * take a mapping of local to repository locations and import that into the repository
      */
-    virtual VcsJob* import( const KUrl& localLocation,
-                            const QString& repositoryLocation,
-                            RecursionMode recursion = KDevelop::IBasicVersionControl::Recursive ) = 0;
+    virtual VcsJob* import( const VcsMapping& localLocation, const QString& commitMessage ) = 0;
 
     /**
      * Checks out files or dirs from a repository into a local directory
Index: vcs/vcsmapping.cpp
===================================================================
--- vcs/vcsmapping.cpp	(Revision 744158)
+++ vcs/vcsmapping.cpp	(Revision 744159)
@@ -22,16 +22,18 @@
 
 #include <QtCore/QMap>
 #include <QtCore/QPair>
-#include <QtCore/QString>
-#include <QtCore/QStringList>
+#include "vcslocation.h"
 
+#include <QtCore/QHash>
+
+
 namespace KDevelop
 {
 
 class VcsMappingPrivate
 {
     public:
-        QMap<QString,QPair<QString, VcsMapping::MappingFlag> > mapping;
+        QHash<VcsLocation,QPair<VcsLocation, VcsMapping::MappingFlag> > mapping;
 };
 
 VcsMapping::VcsMapping()
@@ -50,33 +52,33 @@
     d->mapping = rhs.d->mapping;
 }
 
-void VcsMapping::addMapping( const QString& sourceLocation,
-                    const QString& destinationLocation,
+void VcsMapping::addMapping( const VcsLocation& sourceLocation,
+                    const VcsLocation& destinationLocation,
                     VcsMapping::MappingFlag recursion )
 {
-    QPair<QString,VcsMapping::MappingFlag> val = qMakePair(destinationLocation,recursion);
+    QPair<VcsLocation,VcsMapping::MappingFlag> val = qMakePair(destinationLocation,recursion);
     d->mapping[sourceLocation] = val;
 }
 
-void VcsMapping::removeMapping( const QString& sourceLocation)
+void VcsMapping::removeMapping( const VcsLocation& sourceLocation)
 {
     if( d->mapping.contains(sourceLocation) )
         d->mapping.remove(sourceLocation);
 }
 
-QStringList VcsMapping::sourceLocations() const
+QList<VcsLocation> VcsMapping::sourceLocations() const
 {
     return d->mapping.keys();
 }
 
-QString VcsMapping::destinationLocation( const QString& sourceLocation ) const
+VcsLocation VcsMapping::destinationLocation( const VcsLocation& sourceLocation ) const
 {
     if( d->mapping.contains( sourceLocation ) )
         return d->mapping[sourceLocation].first;
     return QString();
 }
 
-VcsMapping::MappingFlag VcsMapping::mappingFlag( const QString& sourceLocation ) const
+VcsMapping::MappingFlag VcsMapping::mappingFlag( const VcsLocation& sourceLocation ) const
 {
     if( d->mapping.contains( sourceLocation ) )
         return d->mapping[sourceLocation].second;
Index: vcs/vcsmapping.h
===================================================================
--- vcs/vcsmapping.h	(Revision 744158)
+++ vcs/vcsmapping.h	(Revision 744159)
@@ -34,11 +34,11 @@
 namespace KDevelop
 {
 
+class VcsLocation;
+
 /**
- * Small container class that has a mapping of
- * repository-location -> local location including a recursion flag
- *
- * Just a convenient API around QMap\<KUrl, QPair\<KUrl, MappingFlag\>\>
+ * This class stores mappings of vcs locations. Usually one location is a local
+ * location, the other is a repository location.
  */
 class KDEVPLATFORMVCS_EXPORT VcsMapping
 {
@@ -53,13 +53,13 @@
     virtual ~VcsMapping();
     VcsMapping(const VcsMapping&);
 
-    void addMapping( const QString& sourceLocation,
-                     const QString& destinationLocation,
+    void addMapping( const VcsLocation& sourceLocation,
+                     const VcsLocation& destinationLocation,
                      MappingFlag recursion );
-    void removeMapping( const QString& sourceLocation);
-    QStringList sourceLocations() const;
-    QString destinationLocation( const QString& sourceLocation ) const;
-    MappingFlag mappingFlag( const QString& sourceLocation ) const;
+    void removeMapping( const VcsLocation& sourceLocation);
+    QList<VcsLocation> sourceLocations() const;
+    VcsLocation destinationLocation( const VcsLocation& sourceLocation ) const;
+    MappingFlag mappingFlag( const VcsLocation& sourceLocation ) const;
 
     VcsMapping& operator=( const VcsMapping& rhs);
 private:
Index: vcs/vcslocation.cpp
===================================================================
--- vcs/vcslocation.cpp	(Revision 744158)
+++ vcs/vcslocation.cpp	(Revision 744159)
@@ -29,7 +29,11 @@
 {
 public:
     KUrl m_localUrl;
-    QString m_repoLocation;
+    QString m_repoServer;
+    QString m_repoPath;
+    QString m_repoModule;
+    QString m_repoBranch;
+    QString m_repoTag;
     VcsLocation::LocationType m_type;
 };
 
@@ -49,7 +53,7 @@
 VcsLocation::VcsLocation( const QString& s )
     : d(new VcsLocationPrivate)
 {
-    setRepositoryLocation( s );
+    setRepositoryServer( s );
 }
 
 VcsLocation::~VcsLocation()
@@ -62,7 +66,11 @@
 {
     d->m_type = rhs.d->m_type;
     d->m_localUrl = rhs.d->m_localUrl;
-    d->m_repoLocation = rhs.d->m_repoLocation;
+    d->m_repoServer = rhs.d->m_repoServer;
+    d->m_repoPath = rhs.d->m_repoPath;
+    d->m_repoModule = rhs.d->m_repoModule;
+    d->m_repoBranch = rhs.d->m_repoBranch;
+    d->m_repoTag = rhs.d->m_repoTag;
 }
 
 VcsLocation& VcsLocation::operator=( const VcsLocation& rhs )
@@ -71,7 +79,11 @@
         return *this;
     d->m_type = rhs.d->m_type;
     d->m_localUrl = rhs.d->m_localUrl;
-    d->m_repoLocation = rhs.d->m_repoLocation;
+    d->m_repoServer = rhs.d->m_repoServer;
+    d->m_repoPath = rhs.d->m_repoPath;
+    d->m_repoModule = rhs.d->m_repoModule;
+    d->m_repoBranch = rhs.d->m_repoBranch;
+    d->m_repoTag = rhs.d->m_repoTag;
     return *this;
 }
 
@@ -79,9 +91,9 @@
 {
     return d->m_localUrl;
 }
-QString VcsLocation::repositoryLocation() const
+QString VcsLocation::repositoryServer() const
 {
-    return d->m_repoLocation;
+    return d->m_repoServer;
 }
 
 VcsLocation::LocationType VcsLocation::type() const
@@ -91,21 +103,26 @@
 
 bool VcsLocation::isValid() const
 {
-    return( ( d->m_localUrl.isValid() 
-              && d->m_type == VcsLocation::LocalLocation ) 
-            || ( !d->m_repoLocation.isEmpty()
-               && d->m_type == VcsLocation::RepositoryLocation ) );
+    return( ( d->m_localUrl.isValid()
+              && d->m_type == VcsLocation::LocalLocation )
+            || ( !d->m_repoServer.isEmpty()
+                && !d->m_repoModule.isEmpty()
+                && d->m_type == VcsLocation::RepositoryLocation ) );
 }
 
 void VcsLocation::setLocalUrl( const KUrl& url )
 {
-    d->m_repoLocation = QString();
+    d->m_repoServer = QString();
+    d->m_repoModule = QString();
+    d->m_repoBranch = QString();
+    d->m_repoTag = QString();
+    d->m_repoPath = QString();
     d->m_type = VcsLocation::LocalLocation;
     d->m_localUrl = url;
 }
-void VcsLocation::setRepositoryLocation( const QString& location )
+void VcsLocation::setRepositoryServer( const QString& location )
 {
-    d->m_repoLocation = location;
+    d->m_repoServer = location;
     d->m_type = VcsLocation::RepositoryLocation;
     d->m_localUrl = KUrl();
 }
@@ -113,9 +130,63 @@
 bool VcsLocation::operator==( const KDevelop::VcsLocation& rhs )
 {
     return( type() == rhs.type()
-            && repositoryLocation() == rhs.repositoryLocation()
-            && localUrl() == rhs.localUrl() );
+            && repositoryServer() == rhs.repositoryServer()
+            && localUrl() == rhs.localUrl()
+            && repositoryPath() == rhs.repositoryPath()
+            && repositoryModule() == rhs.repositoryModule()
+            && repositoryBranch() == rhs.repositoryBranch()
+            && repositoryTag() == rhs.repositoryTag() );
 }
 
+
+QString VcsLocation::repositoryModule( ) const
+{
+    return d->m_repoModule;
 }
 
+QString VcsLocation::repositoryTag( ) const
+{
+    return d->m_repoTag;
+}
+
+QString VcsLocation::repositoryBranch( ) const
+{
+    return d->m_repoBranch;
+}
+
+QString VcsLocation::repositoryPath( ) const
+{
+    return d->m_repoPath;
+}
+
+void VcsLocation::setRepositoryModule( const QString & module )
+{
+    d->m_repoModule = module;
+    d->m_type = VcsLocation::RepositoryLocation;
+    d->m_localUrl = KUrl();
+}
+
+void VcsLocation::setRepositoryBranch( const QString & branch )
+{
+    d->m_repoBranch = branch;
+    d->m_type = VcsLocation::RepositoryLocation;
+    d->m_localUrl = KUrl();
+}
+
+void VcsLocation::setRepositoryTag( const QString & tag )
+{
+    d->m_repoTag = tag;
+    d->m_type = VcsLocation::RepositoryLocation;
+    d->m_localUrl = KUrl();
+}
+
+void VcsLocation::setRepositoryPath( const QString & path )
+{
+    d->m_repoPath = path;
+    d->m_type = VcsLocation::RepositoryLocation;
+    d->m_localUrl = KUrl();
+}
+
+}
+
+
Index: vcs/vcslocation.h
===================================================================
--- vcs/vcslocation.h	(Revision 744158)
+++ vcs/vcslocation.h	(Revision 744159)
@@ -23,15 +23,18 @@
 #define KDEVVCSLOCATION_H
 
 #include "vcsexport.h"
-#include <QtCore/QString>
+#include <QtCore/QList>
 #include <kurl.h>
 
-class KUrl;
-class QString;
 
 namespace KDevelop
 {
-
+/**
+ * Denotes a local or repository location for a Vcs system
+ *
+ * For the RepositoryLocation type most of the informations
+ * are vcs specific
+ */
 class KDEVPLATFORMVCS_EXPORT VcsLocation
 {
 public:
@@ -48,13 +51,69 @@
     VcsLocation( const VcsLocation& );
     VcsLocation& operator=( const VcsLocation& );
 
+    /**
+     * @returns Local url if this location is a LocalLocation
+     */
     KUrl localUrl() const;
-    QString repositoryLocation() const;
+
+    /**
+     * Returns a string for the repository, usually this identifies the server
+     * @returns a vcs-implementation-specific string identifying the server
+     */
+    QString repositoryServer() const;
+    /**
+     * Returns the module or module path inside the server
+     * @returns a vcs-implementation-specific string identifying the module
+     */
+    QString repositoryModule() const;
+    /**
+     * identifies the tag which this location belongs to
+     * @returns a vcs-implementation-specific string identifying the tag
+     */
+    QString repositoryTag() const;
+    /**
+     * identifies the branch to which this location belongs to
+     * @returns a vcs-implementation-specific string identifying the branch
+     */
+    QString repositoryBranch() const;
+    /**
+     * This can define a path relative to the module, this is used
+     * when identifying a subdirectory or file inside a repository location
+     * @returns a path relative to module
+     */
+    QString repositoryPath() const;
+    /**
+     * @returns the type of this location
+     */
     VcsLocation::LocationType type() const;
 
-    void setLocalUrl( const KUrl& );
-    void setRepositoryLocation( const QString& );
+    /**
+     * Set the local url for this location, automatically sets the type to LocalLocation
+     * @param url the local url
+     */
+    void setLocalUrl( const KUrl& url );
 
+    /**
+     * Set the server string for this location, automatically sets the type to RepositoryLocation
+     */
+    void setRepositoryServer( const QString& );
+    /**
+     * Set the module for this location, automatically sets the type to RepositoryLocation
+     */
+    void setRepositoryModule( const QString& );
+    /**
+     * Set the branch string for this location, automatically sets the type to RepositoryLocation
+     */
+    void setRepositoryBranch( const QString& );
+    /**
+     * Set the tag string for this location, automatically sets the type to RepositoryLocation
+     */
+    void setRepositoryTag( const QString& );
+    /**
+     * Set the path for this location, automatically sets the type to RepositoryLocation
+     */
+    void setRepositoryPath( const QString& );
+
     bool operator==( const KDevelop::VcsLocation& );
 
     bool isValid() const;
@@ -72,14 +131,14 @@
         return qHash(loc.localUrl());
     }else
     {
-        return qHash(loc.repositoryLocation());
+        return qHash(loc.repositoryServer());
     }
 }
 
 inline bool operator==( const KDevelop::VcsLocation& lhs, const KDevelop::VcsLocation& rhs )
 {
     return( lhs.type() == rhs.type()
-            && lhs.repositoryLocation() == rhs.repositoryLocation()
+            && lhs.repositoryServer() == rhs.repositoryServer()
             && lhs.localUrl() == rhs.localUrl() );
 }
 

-- 
You will live to see your grandchildren.




More information about the KDevelop-devel mailing list