changeset 23522:49a58b33d1ce

subrepo: extend git version check to 3 digits This allows more flexibility when a version check is required. Some git features are introduced in a version where only the 3rd digit changes.
author Mathias De Maré <mathias.demare@gmail.com>
date Wed, 10 Dec 2014 08:41:21 +0100
parents f5de2a82b77e
children 01a8dfc79cdc
files mercurial/subrepo.py
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/subrepo.py	Wed Dec 10 08:33:03 2014 +0100
+++ b/mercurial/subrepo.py	Wed Dec 10 08:41:21 2014 +0100
@@ -1136,9 +1136,13 @@
 
     @staticmethod
     def _gitversion(out):
+        m = re.search(r'^git version (\d+)\.(\d+)\.(\d+)', out)
+        if m:
+            return (int(m.group(1)), int(m.group(2)), int(m.group(3)))
+
         m = re.search(r'^git version (\d+)\.(\d+)', out)
         if m:
-            return (int(m.group(1)), int(m.group(2)))
+            return (int(m.group(1)), int(m.group(2)), 0)
 
         return -1
 
@@ -1172,9 +1176,9 @@
         # 1.5.0 but attempt to continue.
         if version == -1:
             return 'unknown'
-        if version < (1, 5):
+        if version < (1, 5, 0):
             return 'abort'
-        elif version < (1, 6):
+        elif version < (1, 6, 0):
             return 'warning'
         return 'ok'