mq: use repo._bookmarks.recordchange instead of repo._bookmarks.write
Before this patch, mq was using repo._bookmarks.write.
This patch replaces this code with the recommended way of saving bookmarks
changes: repo._bookmarks.recordchange.
--- a/hgext/mq.py Tue Nov 17 13:12:46 2015 -0800
+++ b/hgext/mq.py Tue Nov 17 13:12:33 2015 -0800
@@ -68,6 +68,7 @@
from mercurial import commands, cmdutil, hg, scmutil, util, revset
from mercurial import extensions, error, phases
from mercurial import patch as patchmod
+from mercurial import lock as lockmod
from mercurial import localrepo
from mercurial import subrepo
import os, re, errno, shutil
@@ -1790,7 +1791,10 @@
# Ensure we create a new changeset in the same phase than
# the old one.
- if True:
+ lock = tr = None
+ try:
+ lock = repo.lock()
+ tr = repo.transaction('mq')
n = newcommit(repo, oldphase, message, user, ph.date,
match=match, force=True, editor=editor)
# only write patch after a successful commit
@@ -1809,9 +1813,12 @@
marks = repo._bookmarks
for bm in bmlist:
marks[bm] = n
- marks.write()
+ marks.recordchange(tr)
+ tr.close()
self.applied.append(statusentry(n, patchfn))
+ finally:
+ lockmod.release(lock, tr)
except: # re-raises
ctx = repo[cparents[0]]
repo.dirstate.rebuild(ctx.node(), ctx.manifest())