comparison mercurial/revlog.py @ 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 7b6cb7c15109
comparison
equal deleted inserted replaced
27179:b481bf14992d 27180:8e7db961535a
1425 # should we try to build a delta? 1425 # should we try to build a delta?
1426 if prev != nullrev: 1426 if prev != nullrev:
1427 if cachedelta and self._generaldelta and self._lazydeltabase: 1427 if cachedelta and self._generaldelta and self._lazydeltabase:
1428 # Assume what we received from the server is a good choice 1428 # Assume what we received from the server is a good choice
1429 # build delta will reuse the cache 1429 # build delta will reuse the cache
1430 delta = builddelta(cachedelta[0]) 1430 candidatedelta = builddelta(cachedelta[0])
1431 if self._isgooddelta(candidatedelta, textlen):
1432 delta = candidatedelta
1433 elif prev != candidatedelta[3]:
1434 # Try against prev to hopefully save us a fulltext.
1435 delta = builddelta(prev)
1431 elif self._generaldelta: 1436 elif self._generaldelta:
1432 if p2r != nullrev and self._aggressivemergedeltas: 1437 if p2r != nullrev and self._aggressivemergedeltas:
1433 delta = builddelta(p1r) 1438 delta = builddelta(p1r)
1434 delta2 = builddelta(p2r) 1439 delta2 = builddelta(p2r)
1435 p1good = self._isgooddelta(delta, textlen) 1440 p1good = self._isgooddelta(delta, textlen)