Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revlog.py @ 27251:d9bfe6289acf
revlog: don't consider nullrev when choosing delta base
In the most complex case, we try using the incoming delta base, then
we try both parents, and then we try the previous revlog entry. If
none of these result in a good delta, we natually use the null
revision as base. However, we sometimes consider the nullrev before we
have exhausted our other options. Specifically, when both parents are
null, we use the nullrev as delta base if it produces a good delta
(according to _isgooddelta()), and we fail to try the previous revlog
entry as delta base. After 20a9226bdc8a (addrevision: use general
delta when the incoming base delta is bad, 2015-12-01), it can also
happen for non-merge commits when the incoming delta is not good.
The Firefox repo (from many months back) shrinks a tiny bit with this
patch: from 1.855GB to 1.830GB (1.4%). The hg repo itself shrinks even
less: by less than 0.1%. There may be repos that get larger instead.
This undoes the unexplained test change in 20a9226bdc8a.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 04 Dec 2015 17:46:56 -0800 |
parents | bff71fe05768 |
children | 29f50344fa83 |
comparison
equal
deleted
inserted
replaced
27250:bff71fe05768 | 27251:d9bfe6289acf |
---|---|
1430 candidatedelta = builddelta(cachedelta[0]) | 1430 candidatedelta = builddelta(cachedelta[0]) |
1431 tested.add(cachedelta[0]) | 1431 tested.add(cachedelta[0]) |
1432 if self._isgooddelta(candidatedelta, textlen): | 1432 if self._isgooddelta(candidatedelta, textlen): |
1433 delta = candidatedelta | 1433 delta = candidatedelta |
1434 if delta is None and self._generaldelta: | 1434 if delta is None and self._generaldelta: |
1435 parents = [p1r, p2r] | |
1436 # exclude already lazy tested base if any | 1435 # exclude already lazy tested base if any |
1437 parents = [p for p in parents if p not in tested] | 1436 parents = [p for p in (p1r, p2r) |
1437 if p != nullrev and p not in tested] | |
1438 if parents and not self._aggressivemergedeltas: | 1438 if parents and not self._aggressivemergedeltas: |
1439 # Pick whichever parent is closer to us (to minimize the | 1439 # Pick whichever parent is closer to us (to minimize the |
1440 # chance of having to build a fulltext). | 1440 # chance of having to build a fulltext). |
1441 parents = [max(parents)] | 1441 parents = [max(parents)] |
1442 tested.update(parents) | 1442 tested.update(parents) |