You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gump.apache.org by le...@apache.org on 2005/04/17 17:50:46 UTC

svn commit: r161665 - gump/branches/Gump3/pygump/python/gump/plugins/updater.py

Author: leosimons
Date: Sun Apr 17 08:50:46 2005
New Revision: 161665

URL: http://svn.apache.org/viewcvs?view=rev&rev=161665
Log:
Make updater a little more robust.

* pygump/python/gump/plugins/updater.py: if a module directory exists but there is no CVS information inside it, the checkout command will fail and CVS will complain, so protect against that situation by removing the module directory prior to checkout.

Modified:
    gump/branches/Gump3/pygump/python/gump/plugins/updater.py

Modified: gump/branches/Gump3/pygump/python/gump/plugins/updater.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/plugins/updater.py?view=diff&r1=161664&r2=161665
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/plugins/updater.py (original)
+++ gump/branches/Gump3/pygump/python/gump/plugins/updater.py Sun Apr 17 08:50:46 2005
@@ -20,6 +20,7 @@
 __license__   = "http://www.apache.org/licenses/LICENSE-2.0"
 
 import os
+import shutil
 
 from gump.plugins import AbstractPlugin
 from gump.model import CvsRepository, SvnRepository
@@ -70,14 +71,20 @@
             self.update(module, modulepath)
     
     def checkout(self, module, cwd):
+        # no 'CVS', but there is a module dir. That could cause cvs to fail.
+        # get rid of the contents...
+        targetdir=os.path.join(cwd, module.name)
+        if os.path.exists(targetdir):
+            shutil.rmtree(targetdir)
+
         repository = module.repository.to_url()
-        cvs = Popen(['cvs', '-Q', '-d', repository, 'checkout', module.name], cwd=cwd, stdout=PIPE, stderr=STDOUT)
+        cvs = Popen(['cvs', '-q', '-d', repository, 'checkout', module.name], cwd=cwd, stdout=PIPE, stderr=STDOUT)
         module.update_log = cvs.communicate()[0]
         module.update_exit_status = cvs.wait()
         module.update_type = UPDATE_TYPE_CHECKOUT
     
     def update(self, module, cwd):
-        cvs = Popen(['cvs', '-Q', 'up', '-Pd'], cwd=cwd, stdout=PIPE, stderr=STDOUT)
+        cvs = Popen(['cvs', '-q', 'up', '-Pd'], cwd=cwd, stdout=PIPE, stderr=STDOUT)
         module.update_log = cvs.communicate()[0]
         module.update_exit_status = cvs.wait()
         module.update_type = UPDATE_TYPE_UPDATE