[jhbuild] Make it possible to leave the sticky-date branch



commit ccce5132a3bfd2d14f6debdaa9d91a31022f5df5
Author: Dirk Wallenstein <halsmit t-online de>
Date:   Fri Jul 9 11:10:05 2010 +0200

    Make it possible to leave the sticky-date branch
    
    Enable leaving the sticky-date branch by explicitly specifying the
    special sticky-date 'none', which will switch to 'master'.
    
    Move the sticky-date handling before the switch and pull operations in
    _update(), so that the tree can return to a selected state and update
    branches after leaving the sticky-date branch.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=623931

 jhbuild/versioncontrol/git.py |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/jhbuild/versioncontrol/git.py b/jhbuild/versioncontrol/git.py
index 775a242..9c7001e 100644
--- a/jhbuild/versioncontrol/git.py
+++ b/jhbuild/versioncontrol/git.py
@@ -298,6 +298,12 @@ class GitBranch(Branch):
         branch_cmd = ['git', 'checkout'] + quiet + [branch]
         git_extra_args = {'cwd': self.get_checkoutdir(),
                 'extra_env': get_git_extra_env()}
+        if self.config.sticky_date == 'none':
+            current_branch = self.get_current_branch()
+            if current_branch and current_branch == branch:
+                buildscript.execute(['git', 'checkout'] + quiet + ['master'],
+                        **git_extra_args)
+            return
         try:
             buildscript.execute(branch_cmd, **git_extra_args)
         except CommandError:
@@ -403,13 +409,13 @@ class GitBranch(Branch):
         if update_mirror:
             self.update_dvcs_mirror(buildscript)
 
+        if self.config.sticky_date:
+            self.move_to_sticky_date(buildscript)
+
         self.switch_branch_if_necessary(buildscript)
 
         self.pull_current_branch(buildscript)
 
-        if self.config.sticky_date:
-            self.move_to_sticky_date(buildscript)
-
         self._update_submodules(buildscript)
 
     def may_checkout(self, buildscript):



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