bookmark: use 'applychanges' for adding new bookmark
authorBoris Feld <boris.feld@octobus.net>
Mon, 10 Jul 2017 17:10:56 +0200
changeset 33483 146c0371eadf
parent 33482 916d4cde530e
child 33484 2a8ce4e79a47
bookmark: use 'applychanges' for adding new bookmark
mercurial/bookmarks.py
--- a/mercurial/bookmarks.py	Mon Jul 10 17:08:20 2017 +0200
+++ b/mercurial/bookmarks.py	Mon Jul 10 17:10:56 2017 +0200
@@ -758,6 +758,7 @@
     marks = repo._bookmarks
     cur = repo.changectx('.').node()
     newact = None
+    changes = []
     for mark in names:
         mark = checkformat(repo, mark)
         if newact is None:
@@ -769,12 +770,12 @@
         if rev:
             tgt = scmutil.revsingle(repo, rev).node()
         marks.checkconflict(mark, force, tgt)
-        marks[mark] = tgt
+        changes.append((mark, tgt))
+    marks.applychanges(repo, tr, changes)
     if not inactive and cur == marks[newact] and not rev:
         activate(repo, newact)
     elif cur != tgt and newact == repo._activebookmark:
         deactivate(repo)
-    marks.recordchange(tr)
 
 def _printbookmarks(ui, repo, bmarks, **opts):
     """private method to print bookmarks