KDE/kdevplatform/plugins/subversion

Andreas Pakulat apaku at gmx.de
Wed Aug 13 21:50:11 UTC 2008


SVN commit 846713 by apaku:

Implement support for unknown files. Now you also get non-controlled files in the commit dialog and when checking them they get added to svn and comitted.

So from now on there are (almost) no excuses anymore for forgetting to add files to svn :P

CCMAIL:kdevelop-devel at kdevelop.org

 M  +19 -11    svncommitdialog.cpp  
 M  +4 -2      svncommitdialog.h  


--- trunk/KDE/kdevplatform/plugins/subversion/svncommitdialog.cpp #846712:846713
@@ -93,8 +93,8 @@
             if( project )
             {
                 path = project->relativeUrl( info.url() ).pathOrUrl();
-                m_project = project;
             }
+            statusInfos.insert(path, info);
             switch( info.state() )
             {
                 case KDevelop::VcsStatusInfo::ItemAdded:
@@ -106,6 +106,9 @@
                 case KDevelop::VcsStatusInfo::ItemModified:
                     insertRow( i18nc("subversion controlled file was modified", "Modified"), path );
                     break;
+                case KDevelop::VcsStatusInfo::ItemUnknown:
+                    insertRow( i18nc("File not known to subversion", "Unknown"), path, Qt::Unchecked );
+                    break;
                 default:
                     break;
             }
@@ -119,19 +122,24 @@
 KUrl::List SvnCommitDialog::checkedUrls() const
 {
     KUrl::List list;
-
+    KUrl::List addItems;
     QTreeWidgetItemIterator it( ui.files, QTreeWidgetItemIterator::Checked );
     for( ; *it; ++it ){
         KUrl path;
-        if( m_project )
-        {
-            path = m_project->folder();
-            path.addPath( (*it)->text( 2 ) );
-        } else {
-            path = KUrl( (*it)->text( 2 ) );
+        KDevelop::VcsStatusInfo info = statusInfos.value((*it)->text(2));
+        if( info.state() == KDevelop::VcsStatusInfo::ItemUnknown ) {
+            kDebug() << "adding" << info.url() << "to additems";
+            addItems << info.url();
         }
-        list << path;
+        list << info.url();
     }
+    if( !addItems.isEmpty() ) {
+        kDebug() << "Adding new files" << addItems;
+        KDevelop::VcsJob* job = m_part->add( addItems, KDevelop::IBasicVersionControl::NonRecursive );
+        job->exec();
+    } else {
+        kDebug() << "oops no files to add";
+    }
     return list;
 }
 
@@ -145,12 +153,12 @@
     return ui.keepLocksChk->isChecked();
 }
 
-void SvnCommitDialog::insertRow( const QString& state, const KUrl& url )
+void SvnCommitDialog::insertRow( const QString& state, const KUrl& url, Qt::CheckState checkstate )
 {
     QStringList strings;
     strings << "" << state << url.pathOrUrl();
     QTreeWidgetItem *item = new QTreeWidgetItem( ui.files, strings );
-    item->setCheckState(0, Qt::Checked);
+    item->setCheckState(0, checkstate);
 }
 
 void SvnCommitDialog::ok()
--- trunk/KDE/kdevplatform/plugins/subversion/svncommitdialog.h #846712:846713
@@ -14,6 +14,8 @@
 #include "ui_commitdialog.h"
 
 #include <kdialog.h>
+#include <QtCore/QHash>
+#include <vcs/vcsstatusinfo.h>
 
 class KDevSvnPlugin;
 namespace KDevelop
@@ -45,10 +47,10 @@
     void cancel();
 private:
 //     void insertRow( const KDevelop::VcsFileInfo &info );
-    void insertRow( const QString& state, const KUrl& url );
+    void insertRow( const QString& state, const KUrl& url, Qt::CheckState = Qt::Checked );
 
     KDevSvnPlugin *m_part;
-    KDevelop::IProject* m_project;
+    QHash<QString, KDevelop::VcsStatusInfo> statusInfos;
     Ui::SvnCommitDialog ui;
 };
 




More information about the KDevelop-devel mailing list