[PATCH 6 of 7 clowncopter] automv: do not release lock between marking files and the actual commit

Martijn Pieters mj at zopatista.com
Mon Feb 15 12:25:00 EST 2016


# HG changeset patch
# User Martijn Pieters <mjpieters at fb.com>
# Date 1455556567 0
#      Mon Feb 15 17:16:07 2016 +0000
# Node ID 4a57546044d26cc4b2725d404ee60a11ccba3cf9
# Parent  14ed7e41f1afdc0250afe722669dfb4975f6ee94
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 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.


More information about the Mercurial-devel mailing list