[PATCH 2 of 4] commands: allow rev to be a number (including 0)

Greg Ward greg-hg at gerg.ca
Mon Sep 12 19:08:36 CDT 2011


On Sun, Sep 11, 2011 at 11:29 AM, Simon Heimberg <simohe at besonet.ch> wrote:
> # HG changeset patch
> # User Simon Heimberg <simohe at besonet.ch>
> # Date 1315426900 -7200
> # Node ID 3410d54800d1cd162b5702c42da447a18c563217
> # Parent  37e014596b3ac292d90fa2a92faa06ca390c50ad
> commands: allow rev to be a number (including 0)
>
> fixes issue2992
>
> diff -r 37e014596b3a -r 3410d54800d1 mercurial/commands.py
> --- a/mercurial/commands.py     Mit Sep 07 18:22:32 2011 +0200
> +++ b/mercurial/commands.py     Mit Sep 07 22:21:40 2011 +0200
> @@ -380,6 +380,9 @@
>
>     Returns 0 on success.
>     '''
> +
> +    if rev == 0:
> +        rev = "0"
>     if rev and node:
>         raise util.Abort(_("please specify just one revision"))
>
> @@ -698,6 +701,8 @@
>         bookmarks.write(repo)
>         return
>
> +    if rev == 0:
> +        rev = "0" # set a true value

Yuck. Wouldn't it be better to fix the code that is treating an
int/string value as a boolean?

Greg


More information about the Mercurial-devel mailing list