comparison mercurial/commands.py @ 33005:9343fce87789

bookmarks: factor out delete logic from commands We keep the lock in the caller so that future devs are aware of the locking implications.
author Sean Farley <sean@farley.io>
date Mon, 12 Jun 2017 23:02:48 -0700
parents 4f0a7f604449
children e0a8dd6c87c7
comparison
equal deleted inserted replaced
33004:c808862f2e6e 33005:9343fce87789
973 lock = repo.lock() 973 lock = repo.lock()
974 cur = repo.changectx('.').node() 974 cur = repo.changectx('.').node()
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:
989 raise error.Abort(_("new bookmark name required")) 982 raise error.Abort(_("new bookmark name required"))
990 elif len(names) > 1: 983 elif len(names) > 1: