commit: avoid potential deadlock stable
authorPierre-Yves David <pierre-yves.david@fb.com>
Mon, 20 Apr 2015 13:47:04 +0200
branchstable
changeset 1255 a2d4901e211e
parent 1254 87d626390270
child 1256 f8cb01637e75
commit: avoid potential deadlock We must acquire 'wlock' before 'lock'.
README
hgext/evolve.py
--- a/README	Mon Apr 20 13:41:27 2015 +0200
+++ b/README	Mon Apr 20 13:47:04 2015 +0200
@@ -56,6 +56,7 @@
 - discovery: fix misbehaving discovery accros python version
 - pull: properly install the bundle2 par generator
   (avoid sending all markers for each pull)
+- commit: avoid potential deadlock (acquires wlock before lock)
 
 5.1.2 -- 2015-04-01
 
--- a/hgext/evolve.py	Mon Apr 20 13:41:27 2015 +0200
+++ b/hgext/evolve.py	Mon Apr 20 13:47:04 2015 +0200
@@ -2039,8 +2039,9 @@
 @eh.wrapcommand('commit')
 def commitwrapper(orig, ui, repo, *arg, **kwargs):
     if kwargs.get('amend', False):
-        lock = None
+        wlock = lock = None
     else:
+        wlock = repo.wlock()
         lock = repo.lock()
     try:
         obsoleted = kwargs.get('obsolete', [])
@@ -2064,6 +2065,8 @@
     finally:
         if lock is not None:
             lock.release()
+        if wlock is not None:
+            wlock.release()
 
 @command('^touch',
     [('r', 'rev', [], 'revision to update'),