perf: add a --rev attribute to perfindex
authorBoris Feld <boris.feld@octobus.net>
Sat, 01 Dec 2018 15:57:27 +0100
changeset 40784 a0f2641ddd61
parent 40783 e207f0d6c243
child 40785 875d2af8cb4e
perf: add a --rev attribute to perfindex This allow for benchmarking the time necessary to look for other version than the tip.
contrib/perf.py
--- 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