[PATCH evolve-ext] commitwrapper: use bookmarks.recordchange instead of bookmarks.write

Laurent Charignon lcharignon at fb.com
Thu Dec 10 23:09:48 UTC 2015


# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1449788965 28800
#      Thu Dec 10 15:09:25 2015 -0800
# Node ID 9fa67331d30a582f3b7aa0cbaf74a9d153e959bd
# Parent  ed63bf62ff02cf5a1c9c12841b3ed0dfa7eccf2c
commitwrapper: use bookmarks.recordchange instead of bookmarks.write

Before this patch we were using the deprecated API bookmarks.write, this patch
replace its usage by the new API call bookmarks.recordchange.

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -2657,6 +2657,7 @@ def uncommit(ui, repo, *pats, **opts):
 
 @eh.wrapcommand('commit')
 def commitwrapper(orig, ui, repo, *arg, **kwargs):
+    tr = None
     if kwargs.get('amend', False):
         wlock = lock = None
     else:
@@ -2679,10 +2680,16 @@ def commitwrapper(orig, ui, repo, *arg, 
             for book in oldbookmarks:
                 repo._bookmarks[book] = new.node()
             if oldbookmarks:
-                repo._bookmarks.write()
+                if not wlock:
+                    wlock = repo.wlock()
+                if not lock:
+                    lock = repo.lock()
+                tr = repo.transaction('commit')
+                repo._bookmarks.recordchange(tr)
+                tr.close()
         return result
     finally:
-        lockmod.release(lock, wlock)
+        lockmod.release(lock, wlock, tr)
 
 @command('^split',
     [('r', 'rev', [], _("revision to fold")),


More information about the Mercurial-devel mailing list