perf: add `parent-1` as possible source for perfrevlogwrite
authorBoris Feld <boris.feld@octobus.net>
Mon, 05 Nov 2018 15:15:02 +0100
changeset 40554 6c2357029364
parent 40553 631011ff6771
child 40555 b5b3dd4e40c3
perf: add `parent-1` as possible source for perfrevlogwrite This source will use a diff against p1 in all case.
contrib/perf.py
--- a/contrib/perf.py	Fri Oct 19 17:23:29 2018 +0200
+++ b/contrib/perf.py	Mon Nov 05 15:15:02 2018 +0100
@@ -1580,6 +1580,7 @@
 
     Possible source values 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 @@
         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 @@
 
     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})