# HG changeset patch # User Pierre-Yves David # Date 2019-10-08 06:12:15 # Node ID ad801d4af7cdeee09de09b84a17936a1651bf017 # Parent 0b32206c3c86bd62b4ddbe660b1df7898ee56cde perf: use `setup` function in `perfdirfoldmap` 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 --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -1170,14 +1170,16 @@ def perfdirfoldmap(ui, repo, **opts): opts = _byteskwargs(opts) timer, fm = gettimer(ui, opts) dirstate = repo.dirstate - b'a' in dirstate + dirstate._map.dirfoldmap.get(b'a') + + def setup(): + del dirstate._map.dirfoldmap + del dirstate._map._dirs def d(): dirstate._map.dirfoldmap.get(b'a') - del dirstate._map.dirfoldmap - del dirstate._map._dirs - - timer(d) + + timer(d, setup=setup) fm.end()