mercurial/dispatch.py
changeset 27113 77850d2a161c
parent 26587 56b2bcea2529
child 27325 eadbbd14bdc1
--- a/mercurial/dispatch.py	Tue Nov 24 14:23:51 2015 -0800
+++ b/mercurial/dispatch.py	Tue Nov 24 14:23:46 2015 -0800
@@ -320,7 +320,6 @@
     except socket.error as inst:
         ui.warn(_("abort: %s\n") % inst.args[-1])
     except: # re-raises
-        myver = util.version()
         # For compatibility checking, we discard the portion of the hg
         # version after the + on the assumption that if a "normal
         # user" is running a build with a + in it the packager
@@ -328,8 +327,7 @@
         # 'make local' copy of hg (where the version number can be out
         # of date) will be clueful enough to notice the implausible
         # version number and try updating.
-        compare = myver.split('+')[0]
-        ct = tuplever(compare)
+        ct = util.versiontuple(n=2)
         worst = None, ct, ''
         if ui.config('ui', 'supportcontact', None) is None:
             for name, mod in extensions.extensions():
@@ -344,7 +342,7 @@
                 if testedwith == 'internal':
                     continue
 
-                tested = [tuplever(t) for t in testedwith.split()]
+                tested = [util.versiontuple(t, 2) for t in testedwith.split()]
                 if ct in tested:
                     continue
 
@@ -369,7 +367,8 @@
             warning = (_("** unknown exception encountered, "
                          "please report by visiting\n** ") + bugtracker + '\n')
         warning += ((_("** Python %s\n") % sys.version.replace('\n', '')) +
-                    (_("** Mercurial Distributed SCM (version %s)\n") % myver) +
+                    (_("** Mercurial Distributed SCM (version %s)\n") %
+                     util.version()) +
                     (_("** Extensions loaded: %s\n") %
                      ", ".join([x[0] for x in extensions.extensions()])))
         ui.log("commandexception", "%s\n%s\n", warning, traceback.format_exc())
@@ -378,15 +377,6 @@
 
     return -1
 
-def tuplever(v):
-    try:
-        # Assertion: tuplever is only used for extension compatibility
-        # checking. Otherwise, the discarding of extra version fields is
-        # incorrect.
-        return tuple([int(i) for i in v.split('.')[0:2]])
-    except ValueError:
-        return tuple()
-
 def aliasargs(fn, givenargs):
     args = getattr(fn, 'args', [])
     if args: