changeset 42381:e3ee707d42ad

perf: add a --from flag to perfmergecalculate Before this change, `perfmergecalculate` was always benchmarking the merge of the working copy with another revision. We can now benchmark the `mergecalculate` call for any arbitrary pair of revision.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 23 May 2019 11:19:48 +0200
parents 12bd4e2d4d06
children f0bcbbb6541c
files contrib/perf.py
diffstat 1 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf.py	Tue May 28 09:57:53 2019 -0400
+++ b/contrib/perf.py	Thu May 23 11:19:48 2019 +0200
@@ -964,16 +964,24 @@
     fm.end()
 
 @command(b'perfmergecalculate',
-         [(b'r', b'rev', b'.', b'rev to merge against')] + formatteropts)
+         [
+             (b'r', b'rev', b'.', b'rev to merge against'),
+             (b'', b'from', b'', b'rev to merge from'),
+         ] + formatteropts)
 def perfmergecalculate(ui, repo, rev, **opts):
     opts = _byteskwargs(opts)
     timer, fm = gettimer(ui, opts)
-    wctx = repo[None]
+
+    if opts['from']:
+        fromrev = scmutil.revsingle(repo, opts['from'])
+        wctx = repo[fromrev]
+    else:
+        wctx = repo[None]
+        # we don't want working dir files to be stat'd in the benchmark, so
+        # prime that cache
+        wctx.dirty()
     rctx = scmutil.revsingle(repo, rev, rev)
     ancestor = wctx.ancestor(rctx)
-    # we don't want working dir files to be stat'd in the benchmark, so prime
-    # that cache
-    wctx.dirty()
     def d():
         # acceptremote is True because we don't want prompts in the middle of
         # our benchmark