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.
--- 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'