Patchwork [2,of,5] perf: allow to specify the base of the merge in perfmergecalculate

login
register
mail settings
Submitter Pierre-Yves David
Date May 23, 2019, 4:47 p.m.
Message ID <c5959a988d0d0142c62a.1558630076@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/40212/
State Accepted
Headers show

Comments

Pierre-Yves David - May 23, 2019, 4:47 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1558612171 -7200
#      Thu May 23 13:49:31 2019 +0200
# Node ID c5959a988d0d0142c62ab4a0bdd54732f18fc2c9
# Parent  041e1cfff879810c62afef3101db4e8b016a62a4
# EXP-Topic perf-mergecopies
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r c5959a988d0d
perf: allow to specify the base of the merge in perfmergecalculate

We can now test the rebase case.

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -926,6 +926,7 @@  def perfdirstatewrite(ui, repo, **opts):
          [
              (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)
@@ -940,7 +941,18 @@  def perfmergecalculate(ui, repo, rev, **
         # 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