gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r780456 - in /gump/trunk/python/gump: core/model/repository.py core/update/__init__.py core/update/hg.py core/update/updater.py util/sync.py
Date Sun, 31 May 2009 15:35:51 GMT
Author: bodewig
Date: Sun May 31 15:35:50 2009
New Revision: 780456

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

Added:
    gump/trunk/python/gump/core/update/hg.py
      - copied, changed from r780427, 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=780456&r1=780455&r2=780456&view=diff
==============================================================================
--- gump/trunk/python/gump/core/model/repository.py (original)
+++ gump/trunk/python/gump/core/model/repository.py Sun May 31 15:35:50 2009
@@ -38,10 +38,11 @@
 SCM_TYPE_GIT = ScmType('git', 'Git')
 SCM_TYPE_DARCS = ScmType('darcs', 'darcs')
 SCM_TYPE_BZR = ScmType('bzr', 'Bazaar')
+SCM_TYPE_HG = ScmType('hg', 'Mercurial')
 
 # 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_BZR,
+                  SCM_TYPE_GIT, SCM_TYPE_DARCS, SCM_TYPE_BZR, SCM_TYPE_HG,
                   SCM_TYPE_ARTIFACTS]
 
 def scm_type_for_name(name):
@@ -56,7 +57,7 @@
 class Repository(NamedModelObject, Statable):
     """ 
 
-    A named repository (CVS|SVN|Perforce|Artifacts|GIT|darcs|bzr)
+    A named repository (CVS|SVN|Perforce|Artifacts|GIT|darcs|bzr|hg)
 
     """
     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=780456&r1=780455&r2=780456&view=diff
==============================================================================
--- gump/trunk/python/gump/core/update/__init__.py (original)
+++ gump/trunk/python/gump/core/update/__init__.py Sun May 31 15:35:50 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", "bzr"]
+__all__ = ["updater", "cvs", "svn", "jars", "git", "scmupdater", "darcs", "bzr",
+           "hg"]
 
-    

Copied: gump/trunk/python/gump/core/update/hg.py (from r780427, gump/trunk/python/gump/core/update/darcs.py)
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/update/hg.py?p2=gump/trunk/python/gump/core/update/hg.py&p1=gump/trunk/python/gump/core/update/darcs.py&r1=780427&r2=780456&rev=780456&view=diff
==============================================================================
--- gump/trunk/python/gump/core/update/darcs.py (original)
+++ gump/trunk/python/gump/core/update/hg.py Sun May 31 15:35:50 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('^paths.default=(.*)\s*$', re.MULTILINE | re.UNICODE)
 
 ###############################################################################
 # Classes
 ###############################################################################
 
-class DarcsUpdater(ScmUpdater):
+class HgUpdater(ScmUpdater):
     """
-    Updater for darcs
+    Updater for Mercurial
     """
     
     def __init__(self, run):
@@ -44,12 +44,12 @@
 
     def getCheckoutCommand(self, module):
         """
-            Build the appropriate darcs command for get
+            Build the appropriate hg command for clone
         """
-        log_repository_and_url(module, 'darcs')
-        cmd = Cmd('darcs', 'update_' + module.getName(), 
+        log_repository_and_url(module, 'hg')
+        cmd = Cmd('hg', 'update_' + module.getName(), 
                   module.getWorkspace().getSourceControlStagingDirectory())
-        cmd.addParameter('get')
+        cmd.addParameter('clone')
         setup_common_parameters(module, cmd)
         cmd.addParameter(module.getScm().getRootUrl())
         cmd.addParameter(module.getName())
@@ -57,24 +57,25 @@
 
     def getUpdateCommand(self, module):
         """
-            Build the appropriate darcs command for pull
+            Build the appropriate hg command for pull
         """
-        log_repository_and_url(module, 'darcs')
-        cmd = Cmd('darcs', 'update_' + module.getName(), 
+        log_repository_and_url(module, 'hg')
+        cmd = Cmd('hg', 'update_' + module.getName(), 
                   module.getSourceControlStagingDirectory())
         cmd.addParameter('pull')
+        # update working copy
+        cmd.addParameter('-u')
         setup_common_parameters(module, cmd)
         # pull everything, don't ask
-        cmd.addParameter('-a')
+        cmd.addParameter('-y')
         return cmd
 
     def workspaceMatchesModule(self, module):
         """
-            Run darcs query repo to see whether the URL matches
+            Run hg showconfig to see whether the URL matches
         """
-        return match_workspace_template(module, 'darcs query repo',
+        return match_workspace_template(module, 'hg showconfig',
                                         lambda result:
                                             extract_URL(result, URL_REGEX,
-                                                        'darcs query repo'),
-                                        module.getScm().getRootUrl() \
-                                            .rstrip('/'))
+                                                        'hg showconfig'),
+                                        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=780456&r1=780455&r2=780456&view=diff
==============================================================================
--- gump/trunk/python/gump/core/update/updater.py (original)
+++ gump/trunk/python/gump/core/update/updater.py Sun May 31 15:35:50 2009
@@ -24,7 +24,7 @@
 
 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_BZR
+    SCM_TYPE_SVN, SCM_TYPE_P4, SCM_TYPE_DARCS, SCM_TYPE_BZR, SCM_TYPE_HG
 from gump.core.model.workspace import catFileToFileHolder, \
     EXIT_CODE_FAILED, EXIT_CODE_SUCCESS, FILE_TYPE_LOG, \
     gumpSafeName, logResourceUtilization, \
@@ -36,6 +36,7 @@
 from gump.core.update.git import GitUpdater
 from gump.core.update.p4 import P4Updater
 from gump.core.update.svn import SvnUpdater
+from gump.core.update.hg import HgUpdater
 
 def syncModule(module):
     """
@@ -101,6 +102,7 @@
         
         self.updaters = {
             SCM_TYPE_BZR : BzrUpdater(run),
+            SCM_TYPE_HG  : HgUpdater(run),
             SCM_TYPE_CVS : CvsUpdater(run),
             SCM_TYPE_SVN : SvnUpdater(run),
             SCM_TYPE_P4 : P4Updater(run),
@@ -145,7 +147,7 @@
     
         workspace = self.run.getWorkspace()
         
-        log.debug("Workspace CVS|SVN|P4|GIT|darcs|bzr Directory: " \
+        log.debug("Workspace CVS|SVN|P4|GIT|darcs|bzr|hg 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=780456&r1=780455&r2=780456&view=diff
==============================================================================
--- gump/trunk/python/gump/util/sync.py (original)
+++ gump/trunk/python/gump/util/sync.py Sun May 31 15:35:50 2009
@@ -199,7 +199,8 @@
                     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', '.bzr']:
+                    if not name in ['CVS','.svn','.git', '_darcs', '.bzr',
+                                    '.hg']:
                         self.copytree(srcname, dstname, symlinks)
                 else:
                     # Selectively copy file



Mime
View raw message