comparison mercurial/commands.py @ 17818:5023027240a1

bookmarks: use scmutil.checknewlabel Validation is pulled up into the commands module to avoid an import cycle.
author Kevin Bullock <kbullock@ringworld.org>
date Wed, 17 Oct 2012 17:23:39 -0500
parents b17be267b59c
children 361ab1e2086f
comparison
equal deleted inserted replaced
17817:b17be267b59c 17818:5023027240a1
792 def checkformat(mark): 792 def checkformat(mark):
793 mark = mark.strip() 793 mark = mark.strip()
794 if not mark: 794 if not mark:
795 raise util.Abort(_("bookmark names cannot consist entirely of " 795 raise util.Abort(_("bookmark names cannot consist entirely of "
796 "whitespace")) 796 "whitespace"))
797 for c in (':', '\0', '\n', '\r'):
798 if c in mark:
799 raise util.Abort(_("bookmark '%s' contains illegal "
800 "character" % mark))
801 scmutil.checknewlabel(repo, mark)
797 return mark 802 return mark
798 803
799 def checkconflict(repo, mark, force=False): 804 def checkconflict(repo, mark, force=False):
800 if mark in marks and not force: 805 if mark in marks and not force:
801 raise util.Abort(_("bookmark '%s' already exists " 806 raise util.Abort(_("bookmark '%s' already exists "