# HG changeset patch # User Pierre-Yves David # Date 1677014253 -3600 # Node ID 18149ecb51220ad9e93d943466936ef3f3f8495a # Parent 4e95341c89aa6046f5af561ef45159fd80c48ad3 automv: lock the repository before searching for renames I detected this while debugging something else. diff -r 4e95341c89aa -r 18149ecb5122 hgext/automv.py --- a/hgext/automv.py Mon Feb 20 23:46:20 2023 +0100 +++ b/hgext/automv.py Tue Feb 21 22:17:33 2023 +0100 @@ -59,19 +59,21 @@ opts = pycompat.byteskwargs(opts) renames = None disabled = opts.pop(b'no_automv', False) - if not disabled: - threshold = ui.configint(b'automv', b'similarity') - if not 0 <= threshold <= 100: - raise error.Abort(_(b'automv.similarity must be between 0 and 100')) - if threshold > 0: - match = scmutil.match(repo[None], pats, opts) - added, removed = _interestingfiles(repo, match) - uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True) - renames = _findrenames( - repo, uipathfn, added, removed, threshold / 100.0 - ) + with repo.wlock(): + if not disabled: + threshold = ui.configint(b'automv', b'similarity') + if not 0 <= threshold <= 100: + raise error.Abort( + _(b'automv.similarity must be between 0 and 100') + ) + if threshold > 0: + match = scmutil.match(repo[None], pats, opts) + added, removed = _interestingfiles(repo, match) + uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True) + renames = _findrenames( + repo, uipathfn, added, removed, threshold / 100.0 + ) - with repo.wlock(): if renames is not None: with repo.dirstate.changing_files(repo): # XXX this should be wider and integrated with the commit