[PATCH] util: make 'hg log -d --2' abort (issue2734)

Greg Ward greg at gerg.ca
Tue Apr 5 09:11:36 CDT 2011


On 05 April 2011, Yun Lee said:
> # HG changeset patch
> # User Yun Lee <yunlee.bj at gmail.com>
> # Date 1301993747 -28800
> # Node ID b222783806b89a3a1a289111e2378ce8c6092061
> # Parent  086c9f203a53ee4b20a83d06c6e966ecc8a30cbf
> util: make 'hg log -d --2' abort (issue2734)
> 
> diff -r 086c9f203a53 -r b222783806b8 mercurial/util.py
> --- a/mercurial/util.py	Mon Apr 04 23:14:03 2011 -0500
> +++ b/mercurial/util.py	Tue Apr 05 16:55:47 2011 +0800
> @@ -1209,6 +1209,9 @@
>              days = int(date[1:])
>          except ValueError:
>              raise Abort(_("invalid day spec: %s") % date[1:])
> +        if days < 0:
> +            raise Abort(_("%s must be nonnegative, see 'hg help dates'") \
> +                % date[1:])

This is a very, very common grammatical error, but it's still
incorrect English.  See http://en.wikipedia.org/wiki/Comma_splice.

IMHO a colon would be better, i.e.

    raise Abort(_("%s must be nonnegative: see 'hg help dates'")
                % date[1:])

Also, you don't need the backslash since you're inside parentheses.
See http://docs.python.org/reference/lexical_analysis.html under
"Implicit line joining".

        Greg


More information about the Mercurial-devel mailing list