[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdevplatform/plugins/cvs
From:       Robert Gruber <rgruber () users ! sourceforge ! net>
Date:       2008-11-14 11:08:21
Message-ID: 1226660901.047301.19684.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 884124 by rgruber:

Fixed cvs commit feature.
CvsStatusJob no longer forgets about the last file and returns full path
instead of paths relative to the working directory.


 M  +1 -0      cvsproxy.cpp  
 M  +42 -21    cvsstatusjob.cpp  
 M  +3 -0      cvsstatusjob.h  


--- trunk/KDE/kdevplatform/plugins/cvs/cvsproxy.cpp #884123:884124
@@ -435,6 +435,7 @@
 CvsJob * CvsProxy::status(const QString & repo, const KUrl::List & files, bool recursive, bool taginfo)
 {
     CvsStatusJob* job = new CvsStatusJob(vcsplugin);
+    job->setCommunicationMode( KProcess::MergedChannels );
     if ( prepareJob(job, repo) ) {
         *job << "cvs";
         *job << "status";
--- trunk/KDE/kdevplatform/plugins/cvs/cvsstatusjob.cpp #884123:884124
@@ -36,6 +36,37 @@
     return infos;
 }
 
+void CvsStatusJob::addInfoToList(QList<QVariant>& infos, 
+        const QString& currentDir, const QString& filename, 
+        const QString& statusString)
+{
+    KDevelop::VcsStatusInfo::State cvsState = String2EnumState( statusString );
+
+    QString correctedFilename = filename;
+    if (cvsState == KDevelop::VcsStatusInfo::ItemDeleted) {
+        // cvs status writes "no file" in front of the filename
+        // in case the file was locally removed
+        correctedFilename.remove("no file ");
+    }
+
+    // join the current directory (if any) and the found filename ...
+    // note: current directy is always relative to the directory where the 
+    //       cvs command was executed
+    QString file = currentDir;
+    if (file.length() > 0) {
+        file += QDir::separator();
+    }
+    file += correctedFilename;
+
+    // ... and create a VcsFileInfo entry
+    KDevelop::VcsStatusInfo info;
+    info.setUrl(getDirectory() + QDir::separator() + file);
+    info.setState(cvsState);
+
+    kDebug(9500) << "Added status of: " << info.url() << endl;
+    infos << qVariantFromValue( info );
+}
+
 void CvsStatusJob::parseOutput(const QString& jobOutput, QList<QVariant>& infos)
 {
     QString filename;
@@ -60,28 +91,10 @@
 
         if ( re_start.exactMatch(s) ) {
             if ( !filename.isEmpty() ) {
-//                 kDebug(9500) << "File:" << filename << "Status:" << status
-//                          << "working:" << workrev << "repo:" << reporev << endl;
+//                kDebug(9500) << "File:" << filename << "Status:" << status
+//                    << "working:" << workrev << "repo:" << reporev << endl;
 
-                KDevelop::VcsStatusInfo::State cvsState = String2EnumState( status );
-
-                if (cvsState == KDevelop::VcsStatusInfo::ItemDeleted) {
-                    // cvs status writes "no file" in front of the filename
-                    // in case the file was locally removed
-                    filename.remove("no file ");
-                }
-
-                // join the current directory (if any) and the found filename ...
-                QString file = currentDir;
-                if (file.length() > 0)
-                    file += QDir::separator();
-                file += filename;
-
-                // ... and create a VcsFileInfo entry
-                KDevelop::VcsStatusInfo info;
-                info.setUrl(file);
-                info.setState(cvsState);
-                infos << qVariantFromValue( info );
+                addInfoToList( infos, currentDir, filename, status );
             }
             filename.clear();
             status.clear();
@@ -100,6 +113,14 @@
                 currentDir.clear();
         }
     }
+
+    if ( !filename.isEmpty() ) {
+//        kDebug(9500) << "File:" << filename << "Status:" << status
+//            << "working:" << workrev << "repo:" << reporev << endl;
+
+        addInfoToList( infos, currentDir, filename, status );
+    }
+
 }
 
 KDevelop::VcsStatusInfo::State CvsStatusJob::String2EnumState(const QString& stateAsString)
--- trunk/KDE/kdevplatform/plugins/cvs/cvsstatusjob.h #884123:884124
@@ -30,6 +30,9 @@
 
 private:
     void parseOutput(const QString& jobOutput, QList<QVariant>& infos);
+    void addInfoToList(QList<QVariant>& infos, 
+            const QString& currentDir, const QString& filename, 
+            const QString& statusString);
 
     KDevelop::VcsStatusInfo::State String2EnumState(const QString& stateAsString);
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic