changeset 40784:a0f2641ddd61

perf: add a --rev attribute to perfindex This allow for benchmarking the time necessary to look for other version than the tip.
author Boris Feld <boris.feld@octobus.net>
date Sat, 01 Dec 2018 15:57:27 +0100
parents e207f0d6c243
children 875d2af8cb4e
files contrib/perf.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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