automv: do not release lock between marking files and the actual commit
authorMartijn Pieters <mjpieters@fb.com>
Mon, 15 Feb 2016 17:16:07 +0000
changeset 28151 74e3d634a30e
parent 28150 7a984cece04a
child 28152 5ec1ce8fdf0a
automv: do not release lock between marking files and the actual commit
hgext/automv.py
--- a/hgext/automv.py	Mon Feb 15 17:13:18 2016 +0000
+++ b/hgext/automv.py	Mon Feb 15 17:16:07 2016 +0000
@@ -33,6 +33,7 @@
 
 def mvcheck(orig, ui, repo, *pats, **opts):
     """Hook to check for moves at commit time"""
+    renames = None
     disabled = opts.pop('no_automv', False)
     if not disabled:
         threshold = float(ui.config('automv', 'similarity', '1.00'))
@@ -40,9 +41,11 @@
             match = scmutil.match(repo[None], pats, opts)
             added, removed = _interestingfiles(repo, match)
             renames = _findrenames(repo, match, added, removed, threshold)
+
+    with repo.wlock():
+        if renames is not None:
             scmutil._markchanges(repo, (), (), renames)
-
-    return orig(ui, repo, *pats, **opts)
+        return orig(ui, repo, *pats, **opts)
 
 def _interestingfiles(repo, matcher):
     """Find what files were added or removed in this commit.