# HG changeset patch # User Pierre-Yves David # Date 1570514921 14400 # Node ID 100e7e0cdaadb0eac1d4c1ecbffb6ed9e5f96156 # Parent 69301b79fd3695d47701fa8eda6ee28e3344e8cc perf: use `setup` function in `perfdirstatedirs` The command seems to pre-date the introduction of the `setup` support in timer. We move the line that is obviously about benchmark setup in such `setup` function. diff -r 69301b79fd36 -r 100e7e0cdaad contrib/perf.py --- a/contrib/perf.py Tue Oct 08 01:47:35 2019 -0400 +++ b/contrib/perf.py Tue Oct 08 02:08:41 2019 -0400 @@ -1128,13 +1128,15 @@ """ opts = _byteskwargs(opts) timer, fm = gettimer(ui, opts) - b"a" in repo.dirstate + repo.dirstate.hasdir(b"a") + + def setup(): + del repo.dirstate._map._dirs def d(): repo.dirstate.hasdir(b"a") - del repo.dirstate._map._dirs - - timer(d) + + timer(d, setup=setup) fm.end()