graft: avoid potential deadlock stable
authorPierre-Yves David <pierre-yves.david@fb.com>
Mon, 20 Apr 2015 13:48:06 +0200
branchstable
changeset 1256 f8cb01637e75
parent 1255 a2d4901e211e
child 1257 c52c15100fb2
graft: avoid potential deadlock We must acquire 'wlock' before 'lock'.
README
hgext/evolve.py
--- a/README	Mon Apr 20 13:47:04 2015 +0200
+++ b/README	Mon Apr 20 13:48:06 2015 +0200
@@ -57,6 +57,7 @@
 - pull: properly install the bundle2 par generator
   (avoid sending all markers for each pull)
 - commit: avoid potential deadlock (acquires wlock before lock)
+- graft: avoid potential deadlock (acquires wlock before lock)
 
 5.1.2 -- 2015-04-01
 
--- a/hgext/evolve.py	Mon Apr 20 13:47:04 2015 +0200
+++ b/hgext/evolve.py	Mon Apr 20 13:48:06 2015 +0200
@@ -2240,8 +2240,10 @@
     kwargs['rev'] = []
     obsoleted = kwargs.setdefault('obsolete', [])
 
-    lock = repo.lock()
+    wlock = lock = None
     try:
+        wlock = repo.wlock()
+        lock = repo.lock()
         if kwargs.get('old_obsolete'):
             if kwargs.get('continue'):
                 obsoleted.extend(repo.opener.read('graftstate').splitlines())
@@ -2256,7 +2258,7 @@
 
         return commitwrapper(orig, ui, repo,*revs, **kwargs)
     finally:
-        lock.release()
+        lockmod.release(lock, wlock)
 
 @eh.extsetup
 def oldevolveextsetup(ui):