[jhbuild] [git] Make git version checks more readable



commit 6d33f47b511029bd205228a37cff85521da08ce6
Author: Dirk Wallenstein <halsmit t-online de>
Date:   Sun May 16 12:57:18 2010 +0200

    [git] Make git version checks more readable
    
    Wrap the generic version checker into a git specific one and use it.

 jhbuild/versioncontrol/git.py |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/jhbuild/versioncontrol/git.py b/jhbuild/versioncontrol/git.py
index e1722da..51a74bf 100644
--- a/jhbuild/versioncontrol/git.py
+++ b/jhbuild/versioncontrol/git.py
@@ -172,6 +172,10 @@ class GitBranch(Branch):
         return self._execute_git_predicate(
                 ['git', 'rev-parse', '--is-inside-work-tree'])
 
+    def _check_version_git(self, version_spec):
+        return check_version(['git', '--version'], r'git version ([\d.]+)',
+                version_spec, extra_env=get_git_extra_env())
+
     def _get_current_branch(self):
         """Returns either a branchname or None if head is detached"""
         if not self._is_inside_work_tree():
@@ -288,9 +292,7 @@ class GitBranch(Branch):
         if update_mirror:
             self.update_dvcs_mirror(buildscript)
 
-        if check_version(['git', '--version'],
-                     r'git version ([\d.]+)', '1.7.0',
-                     extra_env=get_git_extra_env()):
+        if self._check_version_git('1.7.0'):
             git_diff_submodule = ['--submodule']
         else:
             git_diff_submodule = []
@@ -336,9 +338,7 @@ class GitBranch(Branch):
 
         if stashed:
             # git stash pop was introduced in 1.5.5, 
-            if check_version(['git', '--version'],
-                         r'git version ([\d.]+)', '1.5.5',
-                         extra_env=get_git_extra_env()):
+            if self._check_version_git('1.5.5'):
                 buildscript.execute(['git', 'stash', 'pop'], **git_extra_args)
             else:
                 buildscript.execute(['git', 'stash', 'apply', 'jhbuild-stash'],



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