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

List:       kde-commits
Subject:    KDE/kdevelop/lib/plugins/vcs/cvs
From:       Robert Gruber <rgruber () users ! sourceforge ! net>
Date:       2007-04-20 20:59:21
Message-ID: 1177102761.124540.19341.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 656280 by rgruber:

Added checkout and annotate feature


 M  +2 -0      CMakeLists.txt  
 A             checkoutdialog.cpp   [License: GPL (v2+)]
 A             checkoutdialog.h   [License: GPL (v2+)]
 A             checkoutdialog.ui  
 M  +31 -3     cvspart.cpp  
 M  +2 -0      cvspart.h  
 M  +63 -0     cvsproxy.cpp  
 M  +10 -1     cvsproxy.h  
 M  +2 -0      kdevcvs.rc  


--- trunk/KDE/kdevelop/lib/plugins/vcs/cvs/CMakeLists.txt #656279:656280
@@ -20,6 +20,7 @@
 	commitdialog.cpp
 	updateoptionsdialog.cpp
 	importdialog.cpp
+	checkoutdialog.cpp
 )
 
 set(kdevcvs_PART_UI
@@ -31,6 +32,7 @@
 	commitdialog.ui
 	updateoptionsdialog.ui
 	importdialog.ui
+	checkoutdialog.ui
 )
 
 kde4_add_ui_files(kdevcvs_PART_SRCS ${kdevcvs_PART_UI})
--- trunk/KDE/kdevelop/lib/plugins/vcs/cvs/cvspart.cpp #656279:656280
@@ -37,6 +37,7 @@
 #include "updateoptionsdialog.h"
 #include "cvsgenericoutputview.h"
 #include "importdialog.h"
+#include "checkoutdialog.h"
 
 typedef KGenericFactory<CvsPart> KDevCvsFactory;
 K_EXPORT_COMPONENT_FACTORY( kdevcvs,
@@ -136,6 +137,14 @@
     action->setText(i18n("Import Directory..."));
     connect(action, SIGNAL(triggered(bool)), this, SLOT(slotImport()));
 
+    action = actionCollection()->addAction("cvs_annotate");
+    action->setText(i18n("Annotate..."));
+    connect(action, SIGNAL(triggered(bool)), this, SLOT(slotAnnotate()));
+
+    action = actionCollection()->addAction("cvs_checkout");
+    action->setText(i18n("Checkout..."));
+    connect(action, SIGNAL(triggered(bool)), this, SLOT(slotCheckout()));
+
 }
 
 const KUrl CvsPart::urlFocusedDocument() const
@@ -240,9 +249,20 @@
     createNewProject( KUrl(info.absolutePath()) );
 }
 
+void CvsPart::slotAnnotate()
+{
+    KUrl url = urlFocusedDocument();
+    annotate( url );
+}
 
+void CvsPart::slotCheckout()
+{
+    fetchFromRepository();
+}
 
 
+
+
 ////////////////////////////////////////////////////////////////////////////////
 //  BEGIN of methods derived from IVersionControl
 ////////////////////////////////////////////////////////////////////////////////
@@ -275,7 +295,11 @@
 
 bool CvsPart::fetchFromRepository()
 {
-    /// @todo implemt me !
+    CheckoutDialog dlg(this);
+
+    if (dlg.exec() == QDialog::Accepted) {
+        return true;
+    }
     return false;
 }
 
@@ -306,8 +330,12 @@
 
 void CvsPart::annotate(const KUrl & url)
 {
-    Q_UNUSED(url)
-    /// @todo implemt me !
+    CvsJob* job = d->m_proxy->annotate( url );
+    if (job) {
+        CvsGenericOutputView* view = new CvsGenericOutputView(this, job);
+        emit addNewTabToMainView( view, i18n("Annotate") );
+        job->start();
+    }
 }
 
 void CvsPart::logview(const KUrl & url)
--- trunk/KDE/kdevelop/lib/plugins/vcs/cvs/cvspart.h #656279:656280
@@ -78,6 +78,8 @@
     void slotCommit();
     void slotUpdate();
     void slotImport();
+    void slotAnnotate();
+    void slotCheckout();
 
 // Signals inherited from IVersionControl
 Q_SIGNALS:
--- trunk/KDE/kdevelop/lib/plugins/vcs/cvs/cvsproxy.cpp #656279:656280
@@ -126,6 +126,28 @@
     return NULL;
 }
 
+CvsJob * CvsProxy::annotate(const KUrl & url, const QString & revision)
+{
+    kDebug() << k_funcinfo << endl;
+
+    QFileInfo info(url.path());
+
+    CvsJob* job = new CvsJob(this);
+    if ( prepareJob(job, info.absolutePath()) ) {
+        *job << "cvs";
+        *job << "annotate";
+
+        if (!revision.isEmpty())
+            *job << "-r"<<K3Process::quote(revision);
+
+        *job << K3Process::quote(info.fileName());
+
+        return job;
+    }
+    if (job) delete job;
+    return NULL;
+}
+
 CvsJob* CvsProxy::edit(const QString& repo, const KUrl::List& files)
 {
     kDebug() << k_funcinfo << endl;
@@ -291,5 +313,46 @@
     return NULL;
 }
 
+CvsJob * CvsProxy::checkout(const KUrl & targetDir, 
+                            const QString & server, const QString & module, 
+                            const QString & checkoutOptions, 
+                            const QString & revision, 
+                            bool recursive,
+                            bool pruneDirs)
+{
+    kDebug() << k_funcinfo << endl;
+
+    CvsJob* job = new CvsJob(this);
+    ///@todo when doing a checkout we don't have the targetdir yet,
+    ///      for now it'll work to just run the command from the root
+    if ( prepareJob(job, "/", CvsProxy::CheckOut) ) {
+        *job << "cvs";
+        *job << "-q"; // don't print directory changes
+        *job << "-d" << server;
+        *job << "checkout";
+
+        if (!checkoutOptions.isEmpty())
+            *job << checkoutOptions;
+
+        if (!revision.isEmpty()) {
+            *job << "-r" << revision;
+        }
+
+        if (pruneDirs)
+            *job << "-P";
+
+        if (!recursive)
+            *job << "-l";
+
+        *job << "-d" << targetDir.path();
+
+        *job << module;
+
+        return job;
+    }
+    if (job) delete job;
+    return NULL;
+}
+
 #include "cvsproxy.moc"
 //kate: space-indent on; indent-width 4; replace-tabs on; auto-insert-doxygen on; indent-mode cstyle;
--- trunk/KDE/kdevelop/lib/plugins/vcs/cvs/cvsproxy.h #656279:656280
@@ -61,6 +61,7 @@
     CvsJob* log(const KUrl& file);
     CvsJob* diff(const KUrl& url, const QString& diffOptions="", 
               const QString& revA="", const QString& revB="");
+    CvsJob* annotate(const KUrl& url, const QString& revision="");
     CvsJob* edit(const QString& repo, const KUrl::List& files);
     CvsJob* unedit(const QString& repo, const KUrl::List& files);
     CvsJob* editors(const QString& repo, const KUrl::List& files);
@@ -73,6 +74,13 @@
                 const QString& updateOptions,
                 bool pruneDirs = true, bool createDirs = true);
 
+    CvsJob* checkout(const KUrl& targetDir, 
+                const QString & server, const QString& module,
+                const QString& checkoutOptions="",
+                const QString& revision="",
+                bool recursive = true,
+                bool pruneDirs = true);
+
 private slots:
     void slotResult(KJob* job);
 
@@ -81,7 +89,8 @@
 
     enum RequestedOperation {
         NormalOperation,
-        Import
+        Import,
+        CheckOut
     };
     bool prepareJob(CvsJob* job, const QString& repository, 
                     enum RequestedOperation op = CvsProxy::NormalOperation);
--- trunk/KDE/kdevelop/lib/plugins/vcs/cvs/kdevcvs.rc #656279:656280
@@ -4,6 +4,7 @@
   <Menu name="CVS"><Text>&amp;CVS</Text>
     <Action name="cvs_log" />
     <Action name="cvs_diff" />
+    <Action name="cvs_annotate" />
     <Action name="cvs_edit" />
     <Action name="cvs_unedit" />
     <Action name="cvs_editors" />
@@ -12,6 +13,7 @@
     <Action name="cvs_commit" />
     <Action name="cvs_update" />
     <Action name="cvs_import" />
+    <Action name="cvs_checkout" />
   </Menu>
 </MenuBar>
 </kpartgui>
[prev in list] [next in list] [prev in thread] [next in thread] 

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