repair: use bookmarks.recordchange instead of bookmarks.write
Before this patch we were using the deprecated bookmarks.write api. This
patch replaces the call to bookmarks.write by a call to bookmarks.recordchange.
We move the bookmark code above the code removing the undo file because with
bookmarks.recordchange we have to create a transaction that would create an
undo file.
--- a/mercurial/repair.py Mon Nov 30 16:37:42 2015 -0800
+++ b/mercurial/repair.py Mon Nov 30 16:38:29 2015 -0800
@@ -203,6 +203,18 @@
repo.ui.popbuffer()
f.close()
+ for m in updatebm:
+ bm[m] = repo[newbmtarget].node()
+ lock = tr = None
+ try:
+ lock = repo.lock()
+ tr = repo.transaction('repair')
+ bm.recordchange(tr)
+ tr.close()
+ finally:
+ tr.release()
+ lock.release()
+
# remove undo files
for undovfs, undofile in repo.undofiles():
try:
@@ -212,9 +224,6 @@
ui.warn(_('error removing %s: %s\n') %
(undovfs.join(undofile), str(e)))
- for m in updatebm:
- bm[m] = repo[newbmtarget].node()
- bm.write()
except: # re-raises
if backupfile:
ui.warn(_("strip failed, full bundle stored in '%s'\n")