Mercurial > hg-stable
changeset 12890:b1c839659140 stable
revlog: choose best delta for parentdelta (issue2466)
When parentdelta is enabled, we choose the delta that has the minimum
distance to its base. Otherwise, base may be sufficiently far away to
require a full version, resulting in greatly reduced compression.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 30 Oct 2010 02:47:34 -0500 |
parents | 5482c6b826f4 |
children | b69fd38a034e |
files | mercurial/revlog.py |
diffstat | 1 files changed, 7 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlog.py Sat Oct 30 02:47:34 2010 -0500 +++ b/mercurial/revlog.py Sat Oct 30 02:47:34 2010 -0500 @@ -1194,15 +1194,14 @@ d = None p1r, p2r = self.rev(p1), self.rev(p2) - if self._parentdelta: - deltarev, deltanode = p1r, p1 - flags = REVIDX_PARENTDELTA - else: - deltarev, deltanode = prev, self.node(prev) - # should we try to build a delta? - if deltarev != nullrev: - d = builddelta(deltarev) + if prev != nullrev: + d = builddelta(prev) + if self._parentdelta and prev != p1r: + d2 = builddelta(p1r) + if d2 < d: + d = d2 + flags = REVIDX_PARENTDELTA dist, l, data, base = d # full versions are inserted when the needed deltas