fold: move sanity check after locking
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Mon, 02 May 2016 18:21:54 +0200
changeset 1687 73e0018c423f
parent 1686 474db2d60202
child 1688 031682c1faa2
fold: move sanity check after locking Checking for operation validaty without the locks open us to race condition.
hgext/evolve.py
--- 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()