hgext/convert/hg.py
changeset 26974 4b5dc0d9e899
parent 26973 fdd63acf3215
child 27345 98266b1d144d
--- a/hgext/convert/hg.py	Mon Nov 16 17:14:15 2015 -0800
+++ b/hgext/convert/hg.py	Mon Nov 16 17:15:36 2015 -0800
@@ -23,6 +23,7 @@
 from mercurial.node import bin, hex, nullid
 from mercurial import hg, util, context, bookmarks, error, scmutil, exchange
 from mercurial import phases
+from mercurial import lock as lockmod
 from mercurial import merge as mergemod
 
 from common import NoRepo, commit, converter_source, converter_sink, mapfile
@@ -410,12 +411,19 @@
     def putbookmarks(self, updatedbookmark):
         if not len(updatedbookmark):
             return
-        if True:
+        wlock = lock = tr = None
+        try:
+            wlock = self.repo.wlock()
+            lock = self.repo.lock()
+            tr = self.repo.transaction('bookmark')
             self.ui.status(_("updating bookmarks\n"))
             destmarks = self.repo._bookmarks
             for bookmark in updatedbookmark:
                 destmarks[bookmark] = bin(updatedbookmark[bookmark])
-            destmarks.write()
+            destmarks.recordchange(tr)
+            tr.close()
+        finally:
+            lockmod.release(lock, wlock, tr)
 
     def hascommitfrommap(self, rev):
         # the exact semantics of clonebranches is unclear so we can't say no