diff hgext/evolve.py @ 1255:a2d4901e211e stable

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