changeset 27059:405320cd6198

rebase: use bookmarks.recordchange instead of bookmarks.write Before this patch we were using the old api bookmarks.write instead of bookmarks.recordchange at the end of rebase operations. We move clearstatus within the transaction to make it easier for extensions that wrap transactions operations.
author Laurent Charignon <lcharignon@fb.com>
date Fri, 20 Nov 2015 14:06:31 -0800
parents 616ea95c8f11
children 4613a89bea42
files hgext/rebase.py
diffstat 1 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Fri Nov 20 11:36:05 2015 -0800
+++ b/hgext/rebase.py	Fri Nov 20 14:06:31 2015 -0800
@@ -555,14 +555,19 @@
                 collapsedas = newnode
             clearrebased(ui, repo, state, skipped, collapsedas)
 
-        if True:
+        tr = None
+        try:
+            tr = repo.transaction('bookmark')
             if currentbookmarks:
-                updatebookmarks(repo, targetnode, nstate, currentbookmarks)
+                updatebookmarks(repo, targetnode, nstate, currentbookmarks, tr)
                 if activebookmark not in repo._bookmarks:
                     # active bookmark was divergent one and has been deleted
                     activebookmark = None
+            clearstatus(repo)
+            tr.close()
+        finally:
+            release(tr)
 
-        clearstatus(repo)
         ui.note(_("rebase completed\n"))
         util.unlinkpath(repo.sjoin('undo'), ignoremissing=True)
         if skipped:
@@ -817,7 +822,7 @@
         mq.seriesdirty = True
         mq.savedirty()
 
-def updatebookmarks(repo, targetnode, nstate, originalbookmarks):
+def updatebookmarks(repo, targetnode, nstate, originalbookmarks, tr):
     'Move bookmarks to their correct changesets, and delete divergent ones'
     marks = repo._bookmarks
     for k, v in originalbookmarks.iteritems():
@@ -825,8 +830,7 @@
             # update the bookmarks for revs that have moved
             marks[k] = nstate[v]
             bookmarks.deletedivergent(repo, [targetnode], k)
-
-    marks.write()
+    marks.recordchange(tr)
 
 def storestatus(repo, originalwd, target, state, collapse, keep, keepbranches,
                 external, activebookmark):