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

login
register
mail settings
Submitter Martijn Pieters
Date Feb. 15, 2016, 5:25 p.m.
Message ID <4a57546044d26cc4b272.1455557100@mjpieters-mbp>
Download mbox | patch
Permalink /patch/13208/
State Accepted
Headers show

Comments

Martijn Pieters - Feb. 15, 2016, 5:25 p.m.
# HG changeset patch
# User Martijn Pieters <mjpieters@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

Patch

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.