Commit 77850d2a authored by Gregory Szorc's avatar Gregory Szorc
Browse files

dispatch: use versiontuple()

We have a new generic function for this. Use it.
parent 39c14e89b881
...@@ -320,7 +320,6 @@ ...@@ -320,7 +320,6 @@
except socket.error as inst: except socket.error as inst:
ui.warn(_("abort: %s\n") % inst.args[-1]) ui.warn(_("abort: %s\n") % inst.args[-1])
except: # re-raises except: # re-raises
myver = util.version()
# For compatibility checking, we discard the portion of the hg # For compatibility checking, we discard the portion of the hg
# version after the + on the assumption that if a "normal # version after the + on the assumption that if a "normal
# user" is running a build with a + in it the packager # user" is running a build with a + in it the packager
...@@ -328,8 +327,7 @@ ...@@ -328,8 +327,7 @@
# 'make local' copy of hg (where the version number can be out # 'make local' copy of hg (where the version number can be out
# of date) will be clueful enough to notice the implausible # of date) will be clueful enough to notice the implausible
# version number and try updating. # version number and try updating.
compare = myver.split('+')[0] ct = util.versiontuple(n=2)
ct = tuplever(compare)
worst = None, ct, '' worst = None, ct, ''
if ui.config('ui', 'supportcontact', None) is None: if ui.config('ui', 'supportcontact', None) is None:
for name, mod in extensions.extensions(): for name, mod in extensions.extensions():
...@@ -344,7 +342,7 @@ ...@@ -344,7 +342,7 @@
if testedwith == 'internal': if testedwith == 'internal':
continue continue
tested = [tuplever(t) for t in testedwith.split()] tested = [util.versiontuple(t, 2) for t in testedwith.split()]
if ct in tested: if ct in tested:
continue continue
...@@ -369,7 +367,8 @@ ...@@ -369,7 +367,8 @@
warning = (_("** unknown exception encountered, " warning = (_("** unknown exception encountered, "
"please report by visiting\n** ") + bugtracker + '\n') "please report by visiting\n** ") + bugtracker + '\n')
warning += ((_("** Python %s\n") % sys.version.replace('\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") % (_("** Extensions loaded: %s\n") %
", ".join([x[0] for x in extensions.extensions()]))) ", ".join([x[0] for x in extensions.extensions()])))
ui.log("commandexception", "%s\n%s\n", warning, traceback.format_exc()) ui.log("commandexception", "%s\n%s\n", warning, traceback.format_exc())
...@@ -378,15 +377,6 @@ ...@@ -378,15 +377,6 @@
return -1 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): def aliasargs(fn, givenargs):
args = getattr(fn, 'args', []) args = getattr(fn, 'args', [])
if args: if args:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment