[jhbuild] do not call git stash pop on older git versions



commit 9268d1ee8dec6b3483ef8cc25744f321024e0635
Author: Frederic Peters <fpeters 0d be>
Date:   Fri Apr 24 20:01:38 2009 +0200

    do not call git stash pop on older git versions
    
    The git stash pop command was introduced in 1.5.5, for older versions
    let jhbuild fall back to git stash apply, leaving the change stashed.
    (GNOME #580148)
---
 jhbuild/versioncontrol/git.py |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/jhbuild/versioncontrol/git.py b/jhbuild/versioncontrol/git.py
index 16a7133..3959714 100644
--- a/jhbuild/versioncontrol/git.py
+++ b/jhbuild/versioncontrol/git.py
@@ -30,7 +30,7 @@ import urllib
 import sys
 
 from jhbuild.errors import FatalError, CommandError
-from jhbuild.utils.cmds import get_output
+from jhbuild.utils.cmds import get_output, check_version
 from jhbuild.versioncontrol import Repository, Branch, register_repo_type
 import jhbuild.versioncontrol.svn
 from jhbuild.commands.sanitycheck import inpath
@@ -255,7 +255,12 @@ class GitBranch(Branch):
             buildscript.execute(['git', 'pull', '--rebase'], cwd=cwd)
 
         if stashed:
-            buildscript.execute(['git', 'stash', 'pop'], cwd=cwd)
+            # 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:



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