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.
--- 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):