changeset 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
files README hgext/evolve.py
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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):