Patchwork [2,of,3] subrepo: convert matched string to integer before comparing Git version

login
register
mail settings
Submitter Siddharth Agarwal
Date March 21, 2014, 2:58 a.m.
Message ID <9e261a5993f8b991a3f2.1395370698@dev1738.prn1.facebook.com>
Download mbox | patch
Permalink /patch/4013/
State Accepted
Commit 0c32fafd4b3ba4b9eb799f95d44fdb52a27d96e1
Headers show

Comments

Siddharth Agarwal - March 21, 2014, 2:58 a.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1395369497 25200
#      Thu Mar 20 19:38:17 2014 -0700
# Node ID 9e261a5993f8b991a3f2b24a2b1438e981d7228b
# Parent  fae4002ec0e4060ffe84d6fb11d8ab1f566b2aa1
subrepo: convert matched string to integer before comparing Git version

(1, '4') is greater than (1, 5) so the version check never actually worked.

Patch

diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -1111,7 +1111,7 @@ 
         if not m:
             self._ui.warn(_('cannot retrieve git version'))
             return
-        version = (int(m.group(1)), m.group(2))
+        version = (int(m.group(1)), int(m.group(2)))
         # git 1.4.0 can't work at all, but 1.5.X can in at least some cases,
         # despite the docstring comment.  For now, error on 1.4.0, warn on
         # 1.5.0 but attempt to continue.