[jhbuild] [git] pull after the potential change in branch



commit c68ee4213e4bced32d346b03833cb415177dc049
Author: Frédéric Péters <fpeters 0d be>
Date:   Fri May 15 13:54:12 2009 +0200

    [git] pull after the potential change in branch
---
 jhbuild/versioncontrol/git.py |   25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/jhbuild/versioncontrol/git.py b/jhbuild/versioncontrol/git.py
index ad2b423..fac6680 100644
--- a/jhbuild/versioncontrol/git.py
+++ b/jhbuild/versioncontrol/git.py
@@ -242,22 +242,11 @@ class GitBranch(Branch):
             stashed = True
             buildscript.execute(['git', 'stash', 'save', 'jhbuild-stash'], cwd=cwd)
 
-        current_branch = self.get_current_branch()
-        if current_branch != '(no branch)':
-            buildscript.execute(['git', 'pull', '--rebase'], cwd=cwd)
-
-        if stashed:
-            # git stash pop was introduced in 1.5.5, 
-            if check_version(['git', '--version'],
-                         r'git version ([\d.]+)', '1.5.5'):
-                buildscript.execute(['git', 'stash', 'pop'], cwd=cwd)
-            else:
-                buildscript.execute(['git', 'stash', 'apply', 'jhbuild-stash'], cwd=cwd)
-
         would_be_branch = self.branch or 'master'
         if self.tag:
             buildscript.execute(['git', 'checkout', self.tag], cwd=cwd)
         else:
+            current_branch = self.get_current_branch()
             if current_branch != would_be_branch or current_branch == '(no branch)':
                 if current_branch == '(no branch)':
                     # if user was not on any branch, get back to a known track
@@ -271,6 +260,18 @@ class GitBranch(Branch):
                         buildscript.execute(['git', 'checkout', '--track', '-b',
                             would_be_branch, 'origin/' + would_be_branch], cwd=cwd)
 
+        current_branch = self.get_current_branch()
+        if current_branch != '(no branch)':
+            buildscript.execute(['git', 'pull', '--rebase'], cwd=cwd)
+
+        if stashed:
+            # git stash pop was introduced in 1.5.5, 
+            if check_version(['git', '--version'],
+                         r'git version ([\d.]+)', '1.5.5'):
+                buildscript.execute(['git', 'stash', 'pop'], cwd=cwd)
+            else:
+                buildscript.execute(['git', 'stash', 'apply', 'jhbuild-stash'], cwd=cwd)
+
         if self.config.sticky_date:
             commit = self._get_commit_from_date()
             branch = 'jhbuild-date-branch'



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