changeset 1297:51ec3610968c

inhibit: fix devel warning _inhibitmarkers was taking a transaction without the proper lock. Adding the lock removes the warnings.
author Laurent Charignon <lcharignon@fb.com>
date Wed, 29 Apr 2015 13:01:23 -0700
parents 1ac05eef72ca
children b8c01464323c
files hgext/inhibit.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/inhibit.py	Wed Apr 29 14:23:09 2015 -0700
+++ b/hgext/inhibit.py	Wed Apr 29 13:01:23 2015 -0700
@@ -29,6 +29,7 @@
 from mercurial import revset
 from mercurial import error
 from mercurial import commands
+from mercurial import lock as lockmod
 from mercurial import bookmarks
 from mercurial.i18n import _
 
@@ -126,14 +127,16 @@
     """
     newinhibit = repo.set('::%ln and obsolete()', nodes)
     if newinhibit:
-        tr = repo.transaction('obsinhibit')
+        lock = tr = None
         try:
+            lock = repo.lock()
+            tr = repo.transaction('obsinhibit')
             repo._obsinhibit.update(c.node() for c in newinhibit)
             _schedulewrite(tr, _filterpublic(repo, repo._obsinhibit))
             repo.invalidatevolatilesets()
             tr.close()
         finally:
-            tr.release()
+            lockmod.release(tr, lock)
 
 def _deinhibitmarkers(repo, nodes):
     """lift obsolescence inhibition on a set of nodes