changeset 33483:146c0371eadf

bookmark: use 'applychanges' for adding new bookmark
author Boris Feld <boris.feld@octobus.net>
date Mon, 10 Jul 2017 17:10:56 +0200
parents 916d4cde530e
children 2a8ce4e79a47
files mercurial/bookmarks.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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