Mercurial > hg
changeset 27180:8e7db961535a
addrevision: only use the incoming base if it is a good delta (issue4975)
Before this change, the 'lazydeltabase' would blindly build a delta using the
base provided by the incoming bundle and try to use it. If that base was far
down the revlog, the delta would be seen as "no good" and we would fall back to
a full text revision.
We now check if the delta is good and fallback to a computing a delta again the
tipmost revision otherwise (as we would do without general delta).
Later changesets will improve the logic to compute the fallback delta using the
general delta logic.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 01 Dec 2015 16:06:20 -0800 |
parents | b481bf14992d |
children | a9cecc7b68d3 |
files | mercurial/revlog.py |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlog.py Tue Dec 01 16:22:49 2015 -0800 +++ b/mercurial/revlog.py Tue Dec 01 16:06:20 2015 -0800 @@ -1427,7 +1427,12 @@ if cachedelta and self._generaldelta and self._lazydeltabase: # Assume what we received from the server is a good choice # build delta will reuse the cache - delta = builddelta(cachedelta[0]) + candidatedelta = builddelta(cachedelta[0]) + if self._isgooddelta(candidatedelta, textlen): + delta = candidatedelta + elif prev != candidatedelta[3]: + # Try against prev to hopefully save us a fulltext. + delta = builddelta(prev) elif self._generaldelta: if p2r != nullrev and self._aggressivemergedeltas: delta = builddelta(p1r)