Comments
Patch
@@ -689,5 +689,20 @@ def checkformat(repo, mark):
if not mark:
raise error.Abort(_("bookmark names cannot consist entirely of "
"whitespace"))
scmutil.checknewlabel(repo, mark, 'bookmark')
return mark
+
+def delete(repo, tr, names):
+ """remove a mark from the bookmark store
+
+ Raises an abort error if mark does not exist.
+ """
+ marks = repo._bookmarks
+ for mark in names:
+ if mark not in marks:
+ raise error.Abort(_("bookmark '%s' does not exist") %
+ mark)
+ if mark == repo._activebookmark:
+ deactivate(repo)
+ del marks[mark]
+ marks.recordchange(tr)
@@ -973,18 +973,11 @@ def bookmark(ui, repo, *names, **opts):
lock = repo.lock()
cur = repo.changectx('.').node()
marks = repo._bookmarks
if delete:
tr = repo.transaction('bookmark')
- for mark in names:
- if mark not in marks:
- raise error.Abort(_("bookmark '%s' does not exist") %
- mark)
- if mark == repo._activebookmark:
- bookmarks.deactivate(repo)
- del marks[mark]
-
+ bookmarks.delete(repo, tr, names)
elif rename:
tr = repo.transaction('bookmark')
if not names:
raise error.Abort(_("new bookmark name required"))
elif len(names) > 1: