changeset 1472:a8a4c8b8550d stable

inhibit: add missing locking in wrapper for obsmarker creation The develwarning for transaction without lock rightfully pointed out to this issue. Before this patch we were not locking in the transaction for obsmarker creation and therefore showing the warnings.
author Laurent Charignon <lcharignon@fb.com>
date Thu, 09 Jul 2015 12:42:07 -0700
parents fa1a27009c76
children 89a1103bf139 192bc96d0226
files hgext/inhibit.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/inhibit.py	Fri Jun 26 22:26:48 2015 +0200
+++ b/hgext/inhibit.py	Thu Jul 09 12:42:07 2015 -0700
@@ -155,14 +155,16 @@
 def _createmarkers(orig, repo, relations, flag=0, date=None, metadata=None):
     """wrap markers create to make sure we de-inhibit target nodes"""
     # wrapping transactio to unify the one in each function
-    tr = repo.transaction('add-obsolescence-marker')
+    lock = tr = None
     try:
+        lock = repo.lock()
+        tr = repo.transaction('add-obsolescence-marker')
         orig(repo, relations, flag, date, metadata)
         precs = (r[0].node() for r in relations)
         _deinhibitmarkers(repo, precs)
         tr.close()
     finally:
-        tr.release()
+        lockmod.release(tr, lock)
 
 def transactioncallback(orig, repo, *args, **kwargs):
     """ Wrap localrepo.transaction to inhibit new obsolete changes """