gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r780988 - in /gump/live/python/gump: core/model/repository.py core/update/__init__.py core/update/bzr.py core/update/darcs.py core/update/git.py core/update/hg.py core/update/scmupdater.py core/update/svn.py core/update/updater.py util/sync.py
Date Tue, 02 Jun 2009 09:52:47 GMT
Author: bodewig
Date: Tue Jun  2 09:52:46 2009
New Revision: 780988

URL: http://svn.apache.org/viewvc?rev=780988&view=rev
Log:
support for darcs, Bazaar and Mercurial

Added:
    gump/live/python/gump/core/update/bzr.py
      - copied unchanged from r780456, gump/trunk/python/gump/core/update/bzr.py
    gump/live/python/gump/core/update/darcs.py
      - copied unchanged from r776566, gump/trunk/python/gump/core/update/darcs.py
    gump/live/python/gump/core/update/hg.py
      - copied unchanged from r780456, gump/trunk/python/gump/core/update/hg.py
Modified:
    gump/live/python/gump/core/model/repository.py
    gump/live/python/gump/core/update/__init__.py
    gump/live/python/gump/core/update/git.py
    gump/live/python/gump/core/update/scmupdater.py
    gump/live/python/gump/core/update/svn.py
    gump/live/python/gump/core/update/updater.py
    gump/live/python/gump/util/sync.py

Modified: gump/live/python/gump/core/model/repository.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/model/repository.py?rev=780988&r1=780987&r2=780988&view=diff
==============================================================================
--- gump/live/python/gump/core/model/repository.py (original)
+++ gump/live/python/gump/core/model/repository.py Tue Jun  2 09:52:46 2009
@@ -36,10 +36,13 @@
 SCM_TYPE_ARTIFACTS = ScmType('artifacts', 'Artfifacts')
 SCM_TYPE_P4 = ScmType('p4', 'Perforce')
 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_GIT, SCM_TYPE_DARCS, SCM_TYPE_BZR, SCM_TYPE_HG,
                   SCM_TYPE_ARTIFACTS]
 
 def scm_type_for_name(name):
@@ -54,7 +57,7 @@
 class Repository(NamedModelObject, Statable):
     """ 
 
-    A named repository (CVS|SVN|Perforce|Artifacts|GIT) 
+    A named repository (CVS|SVN|Perforce|Artifacts|GIT|darcs|bzr|hg)
 
     """
     def __init__(self, name, dom, workspace):

Modified: gump/live/python/gump/core/update/__init__.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/update/__init__.py?rev=780988&r1=780987&r2=780988&view=diff
==============================================================================
--- gump/live/python/gump/core/update/__init__.py (original)
+++ gump/live/python/gump/core/update/__init__.py Tue Jun  2 09:52:46 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"]
+__all__ = ["updater", "cvs", "svn", "jars", "git", "scmupdater", "darcs", "bzr",
+           "hg"]
 
-    

Modified: gump/live/python/gump/core/update/git.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/update/git.py?rev=780988&r1=780987&r2=780988&view=diff
==============================================================================
--- gump/live/python/gump/core/update/git.py (original)
+++ gump/live/python/gump/core/update/git.py Tue Jun  2 09:52:46 2009
@@ -16,19 +16,11 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from gump import log
 from gump.core.update.scmupdater import match_workspace_template, ScmUpdater, \
-    should_be_quiet
+    should_be_quiet, log_repository_and_url
 from gump.util.process.command import Cmd
 from gump.util.tools import tailFileToString
 
-def log_repository_and_url(module):
-    repository = module.repository
-    url = module.getScm().getRootUrl()
-    log.debug("GIT URL: [" + url + "] on Repository: " + \
-                  repository.getName())
-
-                  
 def maybe_make_quiet(module, cmd):
     if should_be_quiet(module):    
         cmd.addParameter('--quiet')
@@ -50,7 +42,7 @@
         """
             Build the appropriate GIT command for clone
         """
-        log_repository_and_url(module)
+        log_repository_and_url(module, 'git')
         cmd = Cmd('git-clone', 'update_' + module.getName(), 
                   module.getWorkspace().getSourceControlStagingDirectory())
         maybe_make_quiet(module, cmd)
@@ -62,7 +54,7 @@
         """
             Build the appropriate GIT command for pull
         """
-        log_repository_and_url(module)
+        log_repository_and_url(module, 'git')
         cmd = Cmd('git-pull', 'update_' + module.getName(), 
                   module.getSourceControlStagingDirectory())
         maybe_make_quiet(module, cmd)

Modified: gump/live/python/gump/core/update/scmupdater.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/update/scmupdater.py?rev=780988&r1=780987&r2=780988&view=diff
==============================================================================
--- gump/live/python/gump/core/update/scmupdater.py (original)
+++ gump/live/python/gump/core/update/scmupdater.py Tue Jun  2 09:52:46 2009
@@ -17,6 +17,7 @@
 # limitations under the License.
 
 import os.path
+import StringIO
 
 from gump import log
 
@@ -24,7 +25,7 @@
     REASON_UPDATE_FAILED, STATE_FAILED, STATE_SUCCESS, WORK_TYPE_UPDATE
 from gump.core.run.gumprun import RunSpecific
 from gump.util.process.launcher import execute
-from gump.util.tools import wipeDirectoryTree
+from gump.util.tools import catFile, wipeDirectoryTree
 from gump.util.process.command import getCmdFromString
 
 def should_be_quiet(module):
@@ -61,6 +62,26 @@
     return (expectedURL == actualURL, 'Expected URL \'' + expectedURL + \
                 '\' but working copy was \'' + actualURL + '\'')
 
+def log_repository_and_url(module, scmType):
+    repository = module.repository
+    url = module.getScm().getRootUrl()
+    log.debug(scmType + " URL: [" + url + "] on Repository: " + \
+                  repository.getName())
+
+def extract_URL(result, regex, command):
+    """
+    Extracs the URL from result
+    """
+    stream = StringIO.StringIO()
+    catFile(stream, result.getOutput())
+    output = stream.getvalue()
+    stream.close()
+    match = regex.search(output)
+    if not match:
+        return 'Couldn\'t find URL in ' + command + ' output ' + output
+    return match.group(1)
+
+                  
 ###############################################################################
 # Classes
 ###############################################################################

Modified: gump/live/python/gump/core/update/svn.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/update/svn.py?rev=780988&r1=780987&r2=780988&view=diff
==============================================================================
--- gump/live/python/gump/core/update/svn.py (original)
+++ gump/live/python/gump/core/update/svn.py Tue Jun  2 09:52:46 2009
@@ -17,13 +17,11 @@
 # limitations under the License.
 
 import re
-import StringIO
 
 from gump import log
 from gump.core.update.scmupdater import match_workspace_template, ScmUpdater, \
-    should_be_quiet
+    should_be_quiet, extract_URL
 from gump.util.process.command import Cmd
-from gump.util.tools import catFile
 
 def getCommand(module, forUpdate):
     """
@@ -75,19 +73,6 @@
 
 URL_REGEX = re.compile('^URL:\s+(.*)\s*$', re.MULTILINE | re.UNICODE)
 
-def extract_URL(result):
-    """
-    Extracs the URL from 'svn info' output
-    """
-    stream = StringIO.StringIO()
-    catFile(stream, result.getOutput())
-    output = stream.getvalue()
-    stream.close()
-    match = URL_REGEX.search(output)
-    if not match:
-        return 'Couldn\'t find URL in svn info output ' + output
-    return match.group(1)
-
 ###############################################################################
 # Classes
 ###############################################################################
@@ -117,6 +102,9 @@
         """
             Run svn info to see whether the URL matches
         """
-        return match_workspace_template(module, 'svn info', extract_URL,
+        return match_workspace_template(module, 'svn info',
+                                        lambda result:
+                                            extract_URL(result, URL_REGEX,
+                                                        'svn info'),
                                         module.getScm().getRootUrl() \
                                             .rstrip('/'))

Modified: gump/live/python/gump/core/update/updater.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/update/updater.py?rev=780988&r1=780987&r2=780988&view=diff
==============================================================================
--- gump/live/python/gump/core/update/updater.py (original)
+++ gump/live/python/gump/core/update/updater.py Tue Jun  2 09:52:46 2009
@@ -24,16 +24,19 @@
 
 from gump import log
 from gump.core.model.repository import SCM_TYPE_CVS, SCM_TYPE_GIT, \
-    SCM_TYPE_SVN, SCM_TYPE_P4
+    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, \
     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
 from gump.core.update.p4 import P4Updater
 from gump.core.update.svn import SvnUpdater
+from gump.core.update.hg import HgUpdater
 
 def syncModule(module):
     """
@@ -98,10 +101,13 @@
         RunSpecific.__init__(self, run)
         
         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),
-            SCM_TYPE_GIT : GitUpdater(run)
+            SCM_TYPE_GIT : GitUpdater(run),
+            SCM_TYPE_DARCS : DarcsUpdater(run)
             }
 
 
@@ -141,7 +147,7 @@
     
         workspace = self.run.getWorkspace()
         
-        log.debug("Workspace CVS|SVN|P4|GIT Directory: " \
+        log.debug("Workspace CVS|SVN|P4|GIT|darcs|bzr|hg Directory: " \
                       + workspace.getSourceControlStagingDirectory())
 
         # Update all the modules that have repositories

Modified: gump/live/python/gump/util/sync.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/util/sync.py?rev=780988&r1=780987&r2=780988&view=diff
==============================================================================
--- gump/live/python/gump/util/sync.py (original)
+++ gump/live/python/gump/util/sync.py Tue Jun  2 09:52:46 2009
@@ -198,8 +198,9 @@
                     linkto = os.readlink(srcname)
                     os.symlink(linkto, dstname)
                 elif os.path.isdir(srcname):
-                    # Copy directories, but not CVS/SVN/GIT stuff
-                    if not name in ['CVS','.svn','.git']:
+                    # Copy directories, but not CVS/SVN/GIT etc. stuff
+                    if not name in ['CVS','.svn','.git', '_darcs', '.bzr',
+                                    '.hg']:
                         self.copytree(srcname, dstname, symlinks)
                 else:
                     # Selectively copy file



Mime
View raw message