perf: use `setup` function in `perfdirstate`
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 08 Oct 2019 01:57:10 -0400
changeset 43122 436a6a31df38
parent 43121 ce315b1fc9a7
child 43123 69301b79fd36
perf: use `setup` function in `perfdirstate` 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.
contrib/perf.py
--- a/contrib/perf.py	Tue Oct 08 01:46:57 2019 -0400
+++ b/contrib/perf.py	Tue Oct 08 01:57:10 2019 -0400
@@ -1112,11 +1112,13 @@
     timer, fm = gettimer(ui, opts)
     b"a" in repo.dirstate
 
+    def setup():
+        repo.dirstate.invalidate()
+
     def d():
-        repo.dirstate.invalidate()
         b"a" in repo.dirstate
 
-    timer(d)
+    timer(d, setup=setup)
     fm.end()