Patchwork [04,of,12] bookmark: use 'applychanges' for adding new bookmark

login
register
mail settings
Submitter Boris Feld
Date July 14, 2017, 5:54 p.m.
Message ID <34170eeaa6fbfb43b1ce.1500054842@FB>
Download mbox | patch
Permalink /patch/22363/
State Accepted
Headers show

Comments

Boris Feld - July 14, 2017, 5:54 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1499699456 -7200
#      Mon Jul 10 17:10:56 2017 +0200
# Node ID 34170eeaa6fbfb43b1ceac331ae50678afe10610
# Parent  9f589c0e64901c5a15add541d5213574664fa218
# EXP-Topic tr.changes.bookmarks
bookmark: use 'applychanges' for adding new bookmark

Patch

diff -r 9f589c0e6490 -r 34170eeaa6fb 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