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