changeset 27157:5f2e4eb08e41

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.
author Laurent Charignon <lcharignon@fb.com>
date Mon, 30 Nov 2015 16:38:29 -0800
parents 55fa7c3900ae
children 522ffc189671
files mercurial/repair.py
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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")