changeset 27051:1168499e5266

histedit: make use of bookmarks.recordchange instead of bookmarks.write Before this patch we were using the old api bookmarks.write, this patches replaces its usage by bookmarks.recordchange, the new api to record bookmark changes.
author Laurent Charignon <lcharignon@fb.com>
date Fri, 20 Nov 2015 13:23:47 -0800
parents df9b73d2d444
children b9d0b45df7b2
files hgext/histedit.py
diffstat 1 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/histedit.py	Wed Nov 18 17:40:13 2015 -0800
+++ b/hgext/histedit.py	Fri Nov 20 13:23:47 2015 -0800
@@ -1180,13 +1180,20 @@
             # nothing to move
         moves.append((bk, new[-1]))
     if moves:
-        marks = repo._bookmarks
-        for mark, new in moves:
-            old = marks[mark]
-            ui.note(_('histedit: moving bookmarks %s from %s to %s\n')
-                    % (mark, node.short(old), node.short(new)))
-            marks[mark] = new
-        marks.write()
+        lock = tr = None
+        try:
+            lock = repo.lock()
+            tr = repo.transaction('histedit')
+            marks = repo._bookmarks
+            for mark, new in moves:
+                old = marks[mark]
+                ui.note(_('histedit: moving bookmarks %s from %s to %s\n')
+                        % (mark, node.short(old), node.short(new)))
+                marks[mark] = new
+            marks.recordchange(tr)
+            tr.close()
+        finally:
+            release(tr, lock)
 
 def cleanupnode(ui, repo, name, nodes):
     """strip a group of nodes from the repository