diff hgext/evolve.py @ 1256:f8cb01637e75 stable

graft: avoid potential deadlock We must acquire 'wlock' before 'lock'.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 20 Apr 2015 13:48:06 +0200
parents a2d4901e211e
children c52c15100fb2
line wrap: on
line diff
--- 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):