# HG changeset patch # User Pierre-Yves David # Date 2023-02-05 15:54:26 # Node ID e859f440daa9f7b21f9156f4a49ffa99625d7e38 # Parent 2aacd560cf59494a42b115f8a43d894a45715fd5 locking: grab the wlock before touching the dirstate in `perfdirstatewrite` If we touch the dirstate, we should hold the `wlock`. diff --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -235,6 +235,7 @@ revlogopts = getattr( cmdtable = {} + # for "historical portability": # define parsealiases locally, because cmdutil.parsealiases has been # available since 1.5 (or 6252852b4332) @@ -573,7 +574,6 @@ def _timer( def formatone(fm, timings, title=None, result=None, displayall=False): - count = len(timings) fm.startitem() @@ -1474,7 +1474,8 @@ def perfdirstatewrite(ui, repo, **opts): def d(): ds.write(repo.currenttransaction()) - timer(d, setup=setup) + with repo.wlock(): + timer(d, setup=setup) fm.end()