Mercurial > hg-stable
changeset 40603:e14d44772fb3
perf: add `parent-smallest` as possible source for perfrevlogwrite
This source will use the smallest of the possible diff against parent.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Mon, 05 Nov 2018 15:19:44 +0100 |
parents | b5b3dd4e40c3 |
children | 355ae096faef |
files | contrib/perf.py |
diffstat | 1 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/perf.py Mon Nov 05 15:15:18 2018 +0100 +++ b/contrib/perf.py Mon Nov 05 15:19:44 2018 +0100 @@ -1583,6 +1583,7 @@ * `parent-1`: add from a delta to the first parent * `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) """ opts = _byteskwargs(opts) @@ -1594,7 +1595,7 @@ stoprev = rllen + stoprev source = opts['source'] - validsource = (b'full', b'parent-1', b'parent-2') + validsource = (b'full', b'parent-1', b'parent-2', b'parent-smallest') if source not in validsource: raise error.Abort('invalid source type: %s' % source) @@ -1707,6 +1708,17 @@ parent = p1 baserev = orig.rev(parent) cachedelta = (baserev, orig.revdiff(parent, rev)) + elif source == b'parent-smallest': + p1diff = orig.revdiff(p1, rev) + parent = p1 + diff = p1diff + if p2 != nullid: + p2diff = orig.revdiff(p2, rev) + if len(p1diff) > len(p2diff): + parent = p2 + diff = p2diff + baserev = orig.rev(parent) + cachedelta = (baserev, diff) return ((text, tr, linkrev, p1, p2), {'node': node, 'flags': flags, 'cachedelta': cachedelta})