perf: add a --rev attribute to perfindex
This allow for benchmarking the time necessary to look for other version than
the tip.
--- a/contrib/perf.py Fri Nov 23 06:03:38 2018 +0100
+++ b/contrib/perf.py Sat Dec 01 15:57:27 2018 +0100
@@ -992,13 +992,19 @@
timer(runone, setup=setupone, title=b"load")
fm.end()
-@command(b'perfindex', formatteropts)
+@command(b'perfindex', [
+ (b'', b'rev', '', b'revision to be looked up (default tip)'),
+ ] + formatteropts)
def perfindex(ui, repo, **opts):
import mercurial.revlog
opts = _byteskwargs(opts)
timer, fm = gettimer(ui, opts)
mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg
- n = repo[b"tip"].node()
+ if opts['rev'] is None:
+ n = repo[b"tip"].node()
+ else:
+ rev = scmutil.revsingle(repo, opts['rev'])
+ n = repo[rev].node()
unfi = repo.unfiltered()
# find the filecache func directly