[patch]util:give straightforward abort for -d '--2' to avoid typing mistake (issue2734)

yun lee yun.lee.bj at gmail.com
Tue Apr 5 04:10:11 CDT 2011


Thanks very much, Martin. I have adopted your advice in my new patch
and sent it by patchbomb. It's a good experience, thanks!

2011/4/5 Martin Geisler <mg at aragost.com>:
> yun lee <yun.lee.bj at gmail.com> writes:
>
>> # HG changeset patch
>> # User Yun Lee <yunlee.bj at gmail.com>
>> # Date 1301883915 -28800
>> # Node ID 5514a034b9e6a311fcd4f4562e058e43317e4141
>> # Parent  0995eee8ffe4a24478379fb16fd6c38812bc3dd5
>> util:give straightforward abort for -d '--2' to avoid typing mistake (issue2734)
>
> Add a space and trim it a little so that it becomes something like
>
>  util: make 'hg log -d --2' abort (issue2734)
>
>> diff -r 0995eee8ffe4 -r 5514a034b9e6 mercurial/util.py
>> --- a/mercurial/util.py       Sat Apr 02 11:07:05 2011 +0200
>> +++ b/mercurial/util.py       Mon Apr 04 10:25:15 2011 +0800
>> @@ -1232,6 +1232,8 @@
>>              days = int(date[1:])
>>          except ValueError:
>>              raise Abort(_("invalid day spec: %s") % date[1:])
>> +        if days < 0:
>> +            raise Abort(_("%s is a negative number, do you mean %s?")
>
> While it may help very new users, we don't really use this "You did X
> which makes no sense, did you mean Y?" style in our messages to the
> users. Instead we expect people to look in the help text and so become
> smarter for next time.
>
> So to better fit the normal style I suggest
>
>  "%s must be positive, see 'hg help dates'"
>
>> % (date[1:], date[2:]))
>
> That line should be indented -- I think you are not using the patchbomb
> extension as recommended here?
>
>  http://mercurial.selenic.com/wiki/ContributingChanges
>
>
> --
> Martin Geisler
>
> aragost Trifork
> Professional Mercurial support
> http://mercurial.aragost.com/kick-start/
>



-- 
Yun Lee


More information about the Mercurial-devel mailing list