jhbuild r1998 - in trunk: . jhbuild/versioncontrol



Author: fpeters
Date: Sat Apr  5 17:53:43 2008
New Revision: 1998
URL: http://svn.gnome.org/viewvc/jhbuild?rev=1998&view=rev

Log:
* jhbuild/versioncontrol/git.py: during initial git checkout, don't try
to create a new branch if we already got a local branch with that name
during the initial git-clone.  (follow-up on #511398)

(patch by Christophe Fergeau)



Modified:
   trunk/ChangeLog
   trunk/jhbuild/versioncontrol/git.py

Modified: trunk/jhbuild/versioncontrol/git.py
==============================================================================
--- trunk/jhbuild/versioncontrol/git.py	(original)
+++ trunk/jhbuild/versioncontrol/git.py	Sat Apr  5 17:53:43 2008
@@ -149,8 +149,14 @@
             buildscript.execute(cmd, 'git', cwd=self.config.checkoutroot)
 
         if self.branch:
-            buildscript.execute(['git', 'checkout', '-b', self.branch, self.branchname], 'git',
-                                cwd = self.srcdir)
+            # don't try to create a new branch if we already got a local branch
+            # with that name during the initial git-clone
+            try:
+                buildscript.execute(['git', 'show-branch', self.branch],
+                                    'git', cwd = self.srcdir)
+            except CommandError:
+                buildscript.execute(['git', 'checkout', '-b', self.branch, self.branchname], 'git',
+                                    cwd = self.srcdir)
 
         if self.config.sticky_date:
             self._update(buildscript)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]