##// END OF EJS Templates
bookmarks: factor out delete logic from commands...
Sean Farley -
r33005:9343fce8 default
parent child Browse files
Show More
@@ -691,3 +691,17 b' def checkformat(repo, mark):'
691 "whitespace"))
691 "whitespace"))
692 scmutil.checknewlabel(repo, mark, 'bookmark')
692 scmutil.checknewlabel(repo, mark, 'bookmark')
693 return mark
693 return mark
694
695 def delete(repo, tr, names):
696 """remove a mark from the bookmark store
697
698 Raises an abort error if mark does not exist.
699 """
700 marks = repo._bookmarks
701 for mark in names:
702 if mark not in marks:
703 raise error.Abort(_("bookmark '%s' does not exist") % mark)
704 if mark == repo._activebookmark:
705 deactivate(repo)
706 del marks[mark]
707 marks.recordchange(tr)
@@ -975,14 +975,7 b' def bookmark(ui, repo, *names, **opts):'
975 marks = repo._bookmarks
975 marks = repo._bookmarks
976 if delete:
976 if delete:
977 tr = repo.transaction('bookmark')
977 tr = repo.transaction('bookmark')
978 for mark in names:
978 bookmarks.delete(repo, tr, names)
979 if mark not in marks:
980 raise error.Abort(_("bookmark '%s' does not exist") %
981 mark)
982 if mark == repo._activebookmark:
983 bookmarks.deactivate(repo)
984 del marks[mark]
985
986 elif rename:
979 elif rename:
987 tr = repo.transaction('bookmark')
980 tr = repo.transaction('bookmark')
988 if not names:
981 if not names:
General Comments 0
You need to be logged in to leave comments. Login now