[PATCH] dispatch: tolerate non-standard version strings in tuplever()
Augie Fackler
raf at durin42.com
Fri Jun 1 10:44:43 CDT 2012
Thanks! I did have a couple of comments.
On May 25, 2012, at 7:32 AM, Adrian Buehlmann wrote:
> # HG changeset patch
> # User Adrian Buehlmann <adrian at cadifra.com>
> # Date 1337948647 -7200
> # Node ID c516ea214b28d738e1c6b8010b8d4202c208b572
> # Parent 5d64306f39bb1f7ceab8d482156cd071d75f4d17
> dispatch: tolerate non-standard version strings in tuplever()
should mention issue3470 in the summary line
>
> 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.
>
> diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
> --- a/mercurial/dispatch.py
> +++ b/mercurial/dispatch.py
> @@ -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()
(,) strikes me as the more common way to have an empty tuple, but whatever.
Might be worth printing a warning (later though) that we couldn't identify hg's version and so extension version checks will be broken.
>
> def aliasargs(fn, givenargs):
> args = getattr(fn, 'args', [])
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list