changeset 42382:f0bcbbb6541c

perf: allow to specify the base of the merge in perfmergecalculate We can now test the rebase case.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 23 May 2019 13:49:31 +0200
parents e3ee707d42ad
children 3a3592b40a95
files contrib/perf.py
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf.py	Thu May 23 11:19:48 2019 +0200
+++ b/contrib/perf.py	Thu May 23 13:49:31 2019 +0200
@@ -967,6 +967,7 @@
          [
              (b'r', b'rev', b'.', b'rev to merge against'),
              (b'', b'from', b'', b'rev to merge from'),
+             (b'', b'base', b'', b'the revision to use as base'),
          ] + formatteropts)
 def perfmergecalculate(ui, repo, rev, **opts):
     opts = _byteskwargs(opts)
@@ -981,7 +982,18 @@
         # prime that cache
         wctx.dirty()
     rctx = scmutil.revsingle(repo, rev, rev)
-    ancestor = wctx.ancestor(rctx)
+    if opts['base']:
+        fromrev = scmutil.revsingle(repo, opts['base'])
+        ancestor = repo[fromrev]
+    else:
+        ancestor = wctx.ancestor(rctx)
+    def d():
+        # acceptremote is True because we don't want prompts in the middle of
+        # our benchmark
+        merge.calculateupdates(repo, wctx, rctx, [ancestor], False, False,
+                               acceptremote=True, followcopies=True)
+    timer(d)
+    fm.end()
     def d():
         # acceptremote is True because we don't want prompts in the middle of
         # our benchmark