You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gump.apache.org by bo...@apache.org on 2009/05/31 16:13:33 UTC

svn commit: r780429 - in /gump/trunk/python/gump: core/model/repository.py core/update/__init__.py core/update/bzr.py core/update/updater.py util/sync.py

Author: bodewig
Date: Sun May 31 14:13:32 2009
New Revision: 780429

URL: http://svn.apache.org/viewvc?rev=780429&view=rev
Log:
Bazaar support

Added:
    gump/trunk/python/gump/core/update/bzr.py
      - copied, changed from r776566, gump/trunk/python/gump/core/update/darcs.py
Modified:
    gump/trunk/python/gump/core/model/repository.py
    gump/trunk/python/gump/core/update/__init__.py
    gump/trunk/python/gump/core/update/updater.py
    gump/trunk/python/gump/util/sync.py

Modified: gump/trunk/python/gump/core/model/repository.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/model/repository.py?rev=780429&r1=780428&r2=780429&view=diff
==============================================================================
--- gump/trunk/python/gump/core/model/repository.py (original)
+++ gump/trunk/python/gump/core/model/repository.py Sun May 31 14:13:32 2009
@@ -37,10 +37,11 @@
 SCM_TYPE_P4 = ScmType('p4', 'Perforce')
 SCM_TYPE_GIT = ScmType('git', 'Git')
 SCM_TYPE_DARCS = ScmType('darcs', 'darcs')
+SCM_TYPE_BZR = ScmType('bzr', 'Bazaar')
 
 # sorted by priority, the first matching SCM element inside a module wins
 SUPPORTED_SCMS = [SCM_TYPE_CVS, SCM_TYPE_SVN, SCM_TYPE_P4,
-                  SCM_TYPE_GIT, SCM_TYPE_DARCS,
+                  SCM_TYPE_GIT, SCM_TYPE_DARCS, SCM_TYPE_BZR,
                   SCM_TYPE_ARTIFACTS]
 
 def scm_type_for_name(name):
@@ -55,7 +56,7 @@
 class Repository(NamedModelObject, Statable):
     """ 
 
-    A named repository (CVS|SVN|Perforce|Artifacts|GIT|darcs) 
+    A named repository (CVS|SVN|Perforce|Artifacts|GIT|darcs|bzr)
 
     """
     def __init__(self, name, dom, workspace):

Modified: gump/trunk/python/gump/core/update/__init__.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/update/__init__.py?rev=780429&r1=780428&r2=780429&view=diff
==============================================================================
--- gump/trunk/python/gump/core/update/__init__.py (original)
+++ gump/trunk/python/gump/core/update/__init__.py Sun May 31 14:13:32 2009
@@ -17,6 +17,6 @@
 # limitations under the License.
 
 # tell Python what modules make up the gump.test package
-__all__ = ["updater","cvs","svn","jars", "git", "scmupdater", "darcs"]
+__all__ = ["updater","cvs","svn","jars", "git", "scmupdater", "darcs", "bzr"]
 
     

Copied: gump/trunk/python/gump/core/update/bzr.py (from r776566, gump/trunk/python/gump/core/update/darcs.py)
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/update/bzr.py?p2=gump/trunk/python/gump/core/update/bzr.py&p1=gump/trunk/python/gump/core/update/darcs.py&r1=776566&r2=780429&rev=780429&view=diff
==============================================================================
--- gump/trunk/python/gump/core/update/darcs.py (original)
+++ gump/trunk/python/gump/core/update/bzr.py Sun May 31 14:13:32 2009
@@ -27,15 +27,15 @@
     elif module.isDebug():
         cmd.addParameter('-v')
 
-URL_REGEX = re.compile('^Default Remote:\s+(.*)\s*$', re.MULTILINE | re.UNICODE)
+URL_REGEX = re.compile('^\s*parent branch:\s+(.*)\s*$', re.MULTILINE | re.UNICODE)
 
 ###############################################################################
 # Classes
 ###############################################################################
 
-class DarcsUpdater(ScmUpdater):
+class BzrUpdater(ScmUpdater):
     """
-    Updater for darcs
+    Updater for Bazaar
     """
     
     def __init__(self, run):
@@ -44,12 +44,12 @@
 
     def getCheckoutCommand(self, module):
         """
-            Build the appropriate darcs command for get
+            Build the appropriate bzr command for branch
         """
-        log_repository_and_url(module, 'darcs')
-        cmd = Cmd('darcs', 'update_' + module.getName(), 
+        log_repository_and_url(module, 'bzr')
+        cmd = Cmd('bzr', 'update_' + module.getName(), 
                   module.getWorkspace().getSourceControlStagingDirectory())
-        cmd.addParameter('get')
+        cmd.addParameter('branch')
         setup_common_parameters(module, cmd)
         cmd.addParameter(module.getScm().getRootUrl())
         cmd.addParameter(module.getName())
@@ -57,24 +57,21 @@
 
     def getUpdateCommand(self, module):
         """
-            Build the appropriate darcs command for pull
+            Build the appropriate bzr command for merge
         """
-        log_repository_and_url(module, 'darcs')
-        cmd = Cmd('darcs', 'update_' + module.getName(), 
+        log_repository_and_url(module, 'bzr')
+        cmd = Cmd('bzr', 'update_' + module.getName(), 
                   module.getSourceControlStagingDirectory())
-        cmd.addParameter('pull')
+        cmd.addParameter('merge')
         setup_common_parameters(module, cmd)
-        # pull everything, don't ask
-        cmd.addParameter('-a')
         return cmd
 
     def workspaceMatchesModule(self, module):
         """
-            Run darcs query repo to see whether the URL matches
+            Run bzr info to see whether the URL matches
         """
-        return match_workspace_template(module, 'darcs query repo',
+        return match_workspace_template(module, 'bzr info',
                                         lambda result:
                                             extract_URL(result, URL_REGEX,
-                                                        'darcs query repo'),
-                                        module.getScm().getRootUrl() \
-                                            .rstrip('/'))
+                                                        'bzr info'),
+                                        module.getScm().getRootUrl())

Modified: gump/trunk/python/gump/core/update/updater.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/update/updater.py?rev=780429&r1=780428&r2=780429&view=diff
==============================================================================
--- gump/trunk/python/gump/core/update/updater.py (original)
+++ gump/trunk/python/gump/core/update/updater.py Sun May 31 14:13:32 2009
@@ -24,12 +24,13 @@
 
 from gump import log
 from gump.core.model.repository import SCM_TYPE_CVS, SCM_TYPE_GIT, \
-    SCM_TYPE_SVN, SCM_TYPE_P4, SCM_TYPE_DARCS
+    SCM_TYPE_SVN, SCM_TYPE_P4, SCM_TYPE_DARCS, SCM_TYPE_BZR
 from gump.core.model.workspace import catFileToFileHolder, \
     EXIT_CODE_FAILED, EXIT_CODE_SUCCESS, FILE_TYPE_LOG, \
     gumpSafeName, logResourceUtilization, \
     STATE_FAILED, STATE_SUCCESS, syncDirectories, REASON_SYNC_FAILED
 from gump.core.run.gumprun import RunSpecific
+from gump.core.update.bzr import BzrUpdater
 from gump.core.update.cvs import CvsUpdater
 from gump.core.update.darcs import DarcsUpdater
 from gump.core.update.git import GitUpdater
@@ -99,6 +100,7 @@
         RunSpecific.__init__(self, run)
         
         self.updaters = {
+            SCM_TYPE_BZR : BzrUpdater(run),
             SCM_TYPE_CVS : CvsUpdater(run),
             SCM_TYPE_SVN : SvnUpdater(run),
             SCM_TYPE_P4 : P4Updater(run),
@@ -143,7 +145,7 @@
     
         workspace = self.run.getWorkspace()
         
-        log.debug("Workspace CVS|SVN|P4|GIT|darcs Directory: " \
+        log.debug("Workspace CVS|SVN|P4|GIT|darcs|bzr Directory: " \
                       + workspace.getSourceControlStagingDirectory())
 
         # Update all the modules that have repositories

Modified: gump/trunk/python/gump/util/sync.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/util/sync.py?rev=780429&r1=780428&r2=780429&view=diff
==============================================================================
--- gump/trunk/python/gump/util/sync.py (original)
+++ gump/trunk/python/gump/util/sync.py Sun May 31 14:13:32 2009
@@ -199,7 +199,7 @@
                     os.symlink(linkto, dstname)
                 elif os.path.isdir(srcname):
                     # Copy directories, but not CVS/SVN/GIT etc. stuff
-                    if not name in ['CVS','.svn','.git', '_darcs']:
+                    if not name in ['CVS','.svn','.git', '_darcs', '.bzr']:
                         self.copytree(srcname, dstname, symlinks)
                 else:
                     # Selectively copy file