Mercurial > public > mercurial-scm > hg-stable
diff mercurial/commands.py @ 17821:361ab1e2086f
scmutil: add bad character checking to checknewlabel
This factors out the checks from tags and bookmarks, and newly applies
the same prohibitions to branches. checknewlabel takes a new parameter,
kind, indicating the kind of label being checked.
Test coverage is added for all three types of labels.
author | Kevin Bullock <kbullock@ringworld.org> |
---|---|
date | Wed, 17 Oct 2012 21:42:06 -0500 |
parents | 5023027240a1 |
children | c284085d17a8 |
line wrap: on
line diff
--- a/mercurial/commands.py Wed Oct 17 21:39:07 2012 -0500 +++ b/mercurial/commands.py Wed Oct 17 21:42:06 2012 -0500 @@ -794,11 +794,7 @@ if not mark: raise util.Abort(_("bookmark names cannot consist entirely of " "whitespace")) - for c in (':', '\0', '\n', '\r'): - if c in mark: - raise util.Abort(_("bookmark '%s' contains illegal " - "character" % mark)) - scmutil.checknewlabel(repo, mark) + scmutil.checknewlabel(repo, mark, 'bookmark') return mark def checkconflict(repo, mark, force=False): @@ -5645,7 +5641,7 @@ if len(names) != len(set(names)): raise util.Abort(_('tag names must be unique')) for n in names: - scmutil.checknewlabel(repo, n) + scmutil.checknewlabel(repo, n, 'tag') if not n: raise util.Abort(_('tag names cannot consist entirely of ' 'whitespace'))