Mercurial > public > mercurial-scm > hg
diff mercurial/scmutil.py @ 18566:341868ef0cf6
bookmark: don't allow integers as bookmark/branch/tag names
Bookmarks/branches/tags shouldn't be allowed to be integers because that
overlaps with revision numbers. Right now if a user created one they can't
use it anyway because the revision numbers take precedence.
The check only happens when creating a new bookmark/etc from a command so it
shouldn't affect existing bookmarks/branches/tags or importing branches from
git.
This fix was prompted by us having a user create a bookmark named "404" then
accidentally checkout a very old version of our repository.
author | Durham Goode <durham@fb.com> |
---|---|
date | Tue, 05 Feb 2013 16:22:53 -0800 |
parents | acf4a405e440 |
children | e7b89b5127c2 |
line wrap: on
line diff
--- a/mercurial/scmutil.py Wed Oct 24 23:09:31 2012 +0200 +++ b/mercurial/scmutil.py Tue Feb 05 16:22:53 2013 -0800 @@ -34,6 +34,11 @@ for c in (':', '\0', '\n', '\r'): if c in lbl: raise util.Abort(_("%r cannot be used in a name") % c) + try: + int(lbl) + raise util.Abort(_("a %s cannot have an integer as its name") % kind) + except ValueError: + pass def checkfilename(f): '''Check that the filename f is an acceptable filename for a tracked file'''