changeset 28151:74e3d634a30e

automv: do not release lock between marking files and the actual commit
author Martijn Pieters <mjpieters@fb.com>
date Mon, 15 Feb 2016 17:16:07 +0000
parents 7a984cece04a
children 5ec1ce8fdf0a
files hgext/automv.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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.