# HG changeset patch
# User Martijn Pieters <mjpieters@fb.com>
# Date 2016-02-15 17:16:07
# Node ID 74e3d634a30e3f26eb255eefcc7424fc973c8f30
# Parent  7a984cece04aa17e8bcc0e0a59b2a47d83e6f4be

automv: do not release lock between marking files and the actual commit

diff --git a/hgext/automv.py b/hgext/automv.py
--- a/hgext/automv.py
+++ b/hgext/automv.py
@@ -33,6 +33,7 @@ def extsetup(ui):
 
 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 @@ def mvcheck(orig, ui, repo, *pats, **opt
             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.