# HG changeset patch # User Mathias De Maré # Date 2014-12-10 07:41:21 # Node ID 49a58b33d1ced975fee1e3fd7bb8fca0084017c0 # Parent f5de2a82b77ef9d5209b78546404795c204f0a72 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. diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -1136,9 +1136,13 @@ class gitsubrepo(abstractsubrepo): @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 @@ class gitsubrepo(abstractsubrepo): # 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'