hgext/inhibit.py
changeset 1303 508f9911b042
parent 1297 51ec3610968c
child 1321 8fa74845eb1f
--- a/hgext/inhibit.py	Wed Apr 29 15:12:17 2015 -0700
+++ b/hgext/inhibit.py	Mon Apr 20 13:39:18 2015 -0700
@@ -31,6 +31,7 @@
 from mercurial import commands
 from mercurial import lock as lockmod
 from mercurial import bookmarks
+from mercurial import lock as lockmod
 from mercurial.i18n import _
 
 cmdtable = {}
@@ -68,10 +69,19 @@
     the changeset we are updating to. In other words we don't want any visible
     commit to be obsolete.
     """
-    res = orig(ui, repo, *args, **kwargs)
-    newhead = repo['.'].node()
-    _inhibitmarkers(repo, [newhead])
-    return res
+    wlock = None
+    try:
+        # Evolve is running a hook on lock release to display a warning message 
+        # if the workind dir's parent is obsolete.
+        # We take the lock here to make sure that we inhibit the parent before
+        # that hook get a chance to run.
+        wlock = repo.wlock()
+        res = orig(ui, repo, *args, **kwargs)
+        newhead = repo['.'].node()
+        _inhibitmarkers(repo, [newhead])
+        return res
+    finally:
+        lockmod.release(wlock)
 
 def _bookmarkchanged(orig, bkmstoreinst, *args, **kwargs):
     """ Add inhibition markers to every obsolete bookmarks """