Patchwork [8,of,9,V3] perf: add `storage` as possible source for perfrevlogwrite

login
register
mail settings
Submitter Boris Feld
Date Nov. 6, 2018, 11:27 a.m.
Message ID <d3de1f9690311ba4558a.1541503656@Laptop-Boris.lan>
Download mbox | patch
Permalink /patch/36422/
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 1541427849 -3600
#      Mon Nov 05 15:24:09 2018 +0100
# Node ID d3de1f9690311ba4558a19fd70bcd88e74ffd60b
# Parent  0c64116c5e5da0c6cece45a68ff1fa2fec2318ba
# EXP-Topic revlog-perf
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r d3de1f969031
perf: add `storage` as possible source for perfrevlogwrite

This source will use the stored delta.

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -1584,6 +1584,7 @@  def perfrevlogwrite(ui, repo, file_=None
     * `parent-2`: add from a delta to the second parent if it exists
                   (use a delta from the first parent otherwise)
     * `parent-smallest`: add from the smallest delta (either p1 or p2)
+    * `storage`: add from the existing precomputed deltas
     """
     opts = _byteskwargs(opts)
 
@@ -1595,7 +1596,8 @@  def perfrevlogwrite(ui, repo, file_=None
         stoprev = rllen + stoprev
 
     source = opts['source']
-    validsource = (b'full', b'parent-1', b'parent-2', b'parent-smallest')
+    validsource = (b'full', b'parent-1', b'parent-2', b'parent-smallest',
+                   b'storage')
     if source not in validsource:
         raise error.Abort('invalid source type: %s' % source)
 
@@ -1719,6 +1721,9 @@  def _getrevisionseed(orig, rev, tr, sour
                 diff = p2diff
         baserev = orig.rev(parent)
         cachedelta = (baserev, diff)
+    elif source == b'storage':
+        baserev = orig.deltaparent(rev)
+        cachedelta = (baserev, orig.revdiff(orig.node(baserev), rev))
 
     return ((text, tr, linkrev, p1, p2),
             {'node': node, 'flags':flags, 'cachedelta': cachedelta})