changeset 1687:73e0018c423f

fold: move sanity check after locking Checking for operation validaty without the locks open us to race condition.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Mon, 02 May 2016 18:21:54 +0200
parents 474db2d60202
children 031682c1faa2
files hgext/evolve.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/evolve.py	Mon Apr 25 16:24:42 2016 -0700
+++ b/hgext/evolve.py	Mon May 02 18:21:54 2016 +0200
@@ -3121,12 +3121,13 @@
         ui.write_err(_('single revision specified, nothing to fold\n'))
         return 1
 
-    root, head = _foldcheck(repo, revs)
-
     wlock = lock = None
     try:
         wlock = repo.wlock()
         lock = repo.lock()
+
+        root, head = _foldcheck(repo, revs)
+
         tr = repo.transaction('touch')
         try:
             commitopts = opts.copy()