[PATCH 4 of 9] bookmarks: disallow bookmarks named 'tip', '.', or 'null'

Kevin Bullock kbullock+mercurial at ringworld.org
Thu Oct 18 09:31:37 CDT 2012


On Oct 18, 2012, at 8:22 AM, dsp at php.net wrote:

> On 10/18/2012 05:31 AM, Kevin Bullock wrote:
>> # HG changeset patch
>> # User Kevin Bullock <kbullock at ringworld.org>
>> # Date 1350509563 18000
>> # Node ID 2a50542fd0a2626b1e7bdab5b35d32220f4bbb7f
>> # Parent  de8aa47d28efd29ecdeaeb03f8cc49dc15650fb9
>> bookmarks: disallow bookmarks named 'tip', '.', or 'null'
>> 
>> This makes bookmarks reject the same reserved names as tags and branches.
>> 
>> diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
>> --- a/mercurial/bookmarks.py
>> +++ b/mercurial/bookmarks.py
>> @@ -15,6 +15,8 @@ def checkvalid(mark):
>>         if c in mark:
>>             raise util.Abort(_("bookmark '%s' contains illegal "
>>                 "character" % mark))
>> +    if mark in ['tip', '.', 'null']:
>> +        raise util.Abort(_('the name \'%s\' is reserved') % mark)
> 
> is there a reason not to use _("the name '%s' is reserved") and thus
> don't have to escape ' ?


This was just a copy+paste from the branch checking code (in dirstate.setbranch()). If I'd typed it from scratch (or been a bit more awake when I copied it), I would've used double-quotes. If (when?) this series goes thru another revision I'll change it.

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20121018/159945b8/attachment.html>


More information about the Mercurial-devel mailing list