diff hgext/evolve.py @ 1303:508f9911b042

inhibit: updating to a obsolete commit prints warning message We move the inhibition marker in the same wlock than the update operation, this clears the warning message. To make it work we display the warning message on lock release in evolve.
author Laurent Charignon <lcharignon@fb.com>
date Mon, 20 Apr 2015 13:39:18 -0700
parents ebcf23fe3032
children 31e96036acd3
line wrap: on
line diff
--- a/hgext/evolve.py	Wed Apr 29 15:12:17 2015 -0700
+++ b/hgext/evolve.py	Mon Apr 20 13:39:18 2015 -0700
@@ -616,9 +616,16 @@
 @eh.wrapcommand("pull")
 def wrapmayobsoletewc(origfn, ui, repo, *args, **opts):
     """Warn that the working directory parent is an obsolete changeset"""
-    res = origfn(ui, repo, *args, **opts)
-    if repo['.'].obsolete():
-        ui.warn(_('working directory parent is obsolete!\n'))
+    def warnobsolete():
+        if repo['.'].obsolete():
+            ui.warn(_('working directory parent is obsolete!\n'))
+    wlock = None
+    try:
+        wlock = repo.wlock()
+        repo._afterlock(warnobsolete)
+        res = origfn(ui, repo, *args, **opts)
+    finally:
+        lockmod.release(wlock)
     return res
 
 # XXX this could wrap transaction code