Patchwork [5,of,9,V3] perf: add `parent-1` as possible source for perfrevlogwrite

login
register
mail settings
Submitter Boris Feld
Date Nov. 6, 2018, 11:27 a.m.
Message ID <934e67cf46a673a89aac.1541503653@Laptop-Boris.lan>
Download mbox | patch
Permalink /patch/36420/
State Accepted
Headers show

Comments

Boris Feld - Nov. 6, 2018, 11:27 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1541427302 -3600
#      Mon Nov 05 15:15:02 2018 +0100
# Node ID 934e67cf46a673a89aac27a846977c808b23e071
# Parent  e7f2594431ac5fba43ae345b345d3aab1a4ab47c
# EXP-Topic revlog-perf
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 934e67cf46a6
perf: add `parent-1` as possible source for perfrevlogwrite

This source will use a diff against p1 in all case.

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -1580,6 +1580,7 @@  def perfrevlogwrite(ui, repo, file_=None
 
     Possible source value are:
     * `full`: add from a full text (default).
+    * `parent-1`: add from a delta to the first parent
     """
     opts = _byteskwargs(opts)
 
@@ -1591,7 +1592,7 @@  def perfrevlogwrite(ui, repo, file_=None
         stoprev = rllen + stoprev
 
     source = opts['source']
-    validsource = (b'full',)
+    validsource = (b'full', b'parent-1')
     if source not in validsource:
         raise error.Abort('invalid source type: %s' % source)
 
@@ -1693,6 +1694,9 @@  def _getrevisionseed(orig, rev, tr, sour
 
     if source == b'full':
         text = orig.revision(rev)
+    elif source == b'parent-1':
+        baserev = orig.rev(p1)
+        cachedelta = (baserev, orig.revdiff(p1, rev))
 
     return ((text, tr, linkrev, p1, p2),
             {'node': node, 'flags':flags, 'cachedelta': cachedelta})