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 2014/07/05 19:14:56 UTC
svn commit: r1608066 - in /gump/live/python/gump/core/update: git.py
scmupdater.py
Author: bodewig
Date: Sat Jul 5 17:14:56 2014
New Revision: 1608066
URL: http://svn.apache.org/r1608066
Log:
add support for git submodules
Modified:
gump/live/python/gump/core/update/git.py
gump/live/python/gump/core/update/scmupdater.py
Modified: gump/live/python/gump/core/update/git.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/update/git.py?rev=1608066&r1=1608065&r2=1608066&view=diff
==============================================================================
--- gump/live/python/gump/core/update/git.py (original)
+++ gump/live/python/gump/core/update/git.py Sat Jul 5 17:14:56 2014
@@ -51,6 +51,7 @@ class GitUpdater(ScmUpdater):
module.getWorkspace().getSourceControlStagingDirectory())
cmd.addParameter('clone')
maybe_make_quiet(module, cmd)
+ cmd.addParameter('--recursive')
cmd.addParameter('--branch')
cmd.addParameter(module.getScm().getBranch())
cmd.addParameter(module.getScm().getRootUrl())
@@ -94,3 +95,20 @@ class GitUpdater(ScmUpdater):
lambda result:
tailFileToString(result.getOutput(),
1).rstrip())
+
+ def getPostProcessCommand(self, module, isUpdate):
+ """
+ Run git submodule update --init if this has been an update,
+ if it has been a clone command just before, its recursive flag
+ will already have taken care of everything.
+ """
+ if isUpdate:
+ cmd = Cmd('git', 'submodule_update_' + module.getName(),
+ module.getSourceControlStagingDirectory())
+ cmd.addParameter('submodule')
+ cmd.addParameter('update')
+ cmd.addParameter('--init')
+ cmd.addParameter('--recursive')
+ maybe_make_quiet(module, cmd)
+ return cmd
+ return None
Modified: gump/live/python/gump/core/update/scmupdater.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/update/scmupdater.py?rev=1608066&r1=1608065&r2=1608066&view=diff
==============================================================================
--- gump/live/python/gump/core/update/scmupdater.py (original)
+++ gump/live/python/gump/core/update/scmupdater.py Sat Jul 5 17:14:56 2014
@@ -141,6 +141,19 @@ class ScmUpdater(RunSpecific):
module.performedWork(work)
module.repository.performedWork(work.clone())
+ if cmdResult.isOk():
+ # Execute any postprocessing that may be required
+ cmdPost = self.getPostProcessCommand(module, isUpdate)
+ if cmdPost:
+ log.debug(module.getScm().getScmType().displayName + \
+ " Module PostProcess : " + \
+ module.getName() + ", Repository Name: " + \
+ module.repository.getName())
+ cmdResult = execute(cmdPost, module.getWorkspace().tmpdir)
+ work = CommandWorkItem(WORK_TYPE_UPDATE, cmdPost, cmdResult)
+ module.performedWork(work)
+ module.repository.performedWork(work.clone())
+
# Update Context w/ Results
if not cmdResult.isOk():
log.error('Failed to checkout/update module: ' + module.name)
@@ -219,3 +232,15 @@ class ScmUpdater(RunSpecific):
This base implementation returns (True, '')
"""
return (True, '')
+
+ def getPostProcessCommand(self, module, isUpdate):
+ """
+ Get a command that is supposed to post-process a checked-out
+ or updated working copy.
+
+ This has been introduced in order to update git submodules and
+ is currently not used by any other scm updater.
+
+ This base implementation returns None
+ """
+ return None