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.