gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1307230 - in /gump/live: ./ python/gump/core/language/java.py python/gump/core/update/bzr.py python/gump/core/update/darcs.py python/gump/core/update/git.py python/gump/core/update/hg.py
Date Fri, 30 Mar 2012 03:59:13 GMT
Author: bodewig
Date: Fri Mar 30 03:59:12 2012
New Revision: 1307230

URL: http://svn.apache.org/viewvc?rev=1307230&view=rev
Log:
merge branch checking for git from trunk

Modified:
    gump/live/   (props changed)
    gump/live/python/gump/core/language/java.py   (props changed)
    gump/live/python/gump/core/update/bzr.py   (props changed)
    gump/live/python/gump/core/update/darcs.py   (props changed)
    gump/live/python/gump/core/update/git.py
    gump/live/python/gump/core/update/hg.py   (props changed)

Propchange: gump/live/
------------------------------------------------------------------------------
  Merged /gump/trunk:r1306165

Propchange: gump/live/python/gump/core/language/java.py
------------------------------------------------------------------------------
  Merged /gump/trunk/python/gump/core/language/java.py:r1306165

Propchange: gump/live/python/gump/core/update/bzr.py
------------------------------------------------------------------------------
  Merged /gump/trunk/python/gump/core/update/bzr.py:r1306165

Propchange: gump/live/python/gump/core/update/darcs.py
------------------------------------------------------------------------------
  Merged /gump/trunk/python/gump/core/update/darcs.py:r1306165

Modified: gump/live/python/gump/core/update/git.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/update/git.py?rev=1307230&r1=1307229&r2=1307230&view=diff
==============================================================================
--- gump/live/python/gump/core/update/git.py (original)
+++ gump/live/python/gump/core/update/git.py Fri Mar 30 03:59:12 2012
@@ -16,15 +16,19 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import re
 from gump.core.update.scmupdater import match_workspace_template, ScmUpdater, \
-    should_be_quiet, log_repository_and_url
-from gump.util.process.command import Cmd
+    should_be_quiet, log_repository_and_url, extract_URL
+from gump.util.process.command import Cmd, getCmdFromString
+from gump.util.process.launcher import execute
 from gump.util.tools import tailFileToString
 
 def maybe_make_quiet(module, cmd):
     if should_be_quiet(module):    
         cmd.addParameter('--quiet')
 
+BRANCH_REGEX = re.compile('^\* (.*)$', re.MULTILINE | re.UNICODE)
+
 ###############################################################################
 # Classes
 ###############################################################################
@@ -68,8 +72,24 @@ class GitUpdater(ScmUpdater):
 
     def workspaceMatchesModule(self, module):
         """
-            Run git config remote.origin.url to see whether the URL matches
+            Run git branch and git config remote.origin.url
+            to see whether the branch and URL match
         """
+        cmd = getCmdFromString('git branch',
+                               'check_workspace_branch_' + module.getName(), 
+                               module.getSourceControlStagingDirectory())
+        result = execute(cmd)
+
+        if not result.isOk():
+            return (False, 'git branch returned ' + str(result.exit_code))
+        elif not result.hasOutput():
+            return (False, 'git branch didn\'t return any output.')
+
+        current_branch = extract_URL(result, BRANCH_REGEX, 'git branch')
+        if module.getScm().getBranch() != current_branch:
+            return (False, 'Expected branch \'' + module.getScm().getBranch() \
+                        + '\' but working copy was \'' + current_branch + '\'')
+
         return match_workspace_template(module, 'git config remote.origin.url',
                                         lambda result:
                                             tailFileToString(result.getOutput(),

Propchange: gump/live/python/gump/core/update/hg.py
------------------------------------------------------------------------------
  Merged /gump/trunk/python/gump/core/update/hg.py:r1306165



Mime
View raw message