--- a/mercurial/bookmarks.py Tue Jun 20 14:35:53 2017 -0700
+++ b/mercurial/bookmarks.py Sat Jun 10 23:32:58 2017 -0700
@@ -19,6 +19,7 @@
error,
lock as lockmod,
obsolete,
+ scmutil,
txnutil,
util,
)
@@ -622,3 +623,15 @@
else:
# still an independent clause as it is lazier (and therefore faster)
return old.descendant(new)
+
+def checkformat(repo, mark):
+ """return a valid version of a potential bookmark name
+
+ Raises an abort error if the bookmark name is not valid.
+ """
+ mark = mark.strip()
+ if not mark:
+ raise error.Abort(_("bookmark names cannot consist entirely of "
+ "whitespace"))
+ scmutil.checknewlabel(repo, mark, 'bookmark')
+ return mark