changeset 16839:0a0cf3f26938

dispatch: tolerate non-standard version strings in tuplever() (issue3470) When developing, we may see non-standard version strings of the form 5d64306f39bb+20120525 which caused tuplever() to raise ValueError: invalid literal for int() with base 10: '5d64306f39bb' and shadowing the real traceback.
author Adrian Buehlmann <adrian@cadifra.com>
date Fri, 25 May 2012 14:24:07 +0200
parents d37d221334be
children ac3e063eebf1
files mercurial/dispatch.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dispatch.py	Thu May 24 13:05:06 2012 +0200
+++ b/mercurial/dispatch.py	Fri May 25 14:24:07 2012 +0200
@@ -252,8 +252,10 @@
     return -1
 
 def tuplever(v):
-    return tuple([int(i) for i in v.split('.')])
-
+    try:
+        return tuple([int(i) for i in v.split('.')])
+    except ValueError:
+        return tuple()
 
 def aliasargs(fn, givenargs):
     args = getattr(fn, 'args', [])