[PATCH 0 of 4] allow 0 as argument in mercurial/commands

Simon Heimberg simohe at besonet.ch
Sun Sep 11 15:29:04 UTC 2011


Some commands work with integer (int) arguments but behave differently with 0.
This is because bool(0) is False and bool(2) (or any number != 0) is True.

The functions provided as api for other projects should have a more consistent 
behavior (this are mainly mercurial/commands and mercurial/hg).

I fixed all rev arguments in the mentioned modules. Argument node has the 
same problem but will probably not be used with a number because rev is 
there too and node sounds like node id.

The test is integrated in another one. Would a separate one be better?

For testing if I found all places with if var: I wrote a check in
check-code. The places to ignore I marked with a comment.
I send this separate when it is nicely done.


More information about the Mercurial-devel mailing list