##// END OF EJS Templates
addrevision: rework generaldelta computation...
Pierre-Yves David -
r27189:7b6cb7c1 default
parent child Browse files
Show More
@@ -1434,34 +1434,23 b' class revlog(object):'
1434 # Try against prev to hopefully save us a fulltext.
1434 # Try against prev to hopefully save us a fulltext.
1435 delta = builddelta(prev)
1435 delta = builddelta(prev)
1436 elif self._generaldelta:
1436 elif self._generaldelta:
1437 if p2r != nullrev and self._aggressivemergedeltas:
1437 parents = [p1r, p2r]
1438 delta = builddelta(p1r)
1438 if not self._aggressivemergedeltas:
1439 delta2 = builddelta(p2r)
1440 p1good = self._isgooddelta(delta, textlen)
1441 p2good = self._isgooddelta(delta2, textlen)
1442 if p1good and p2good:
1443 # If both are good deltas, choose the smallest
1444 if delta2[1] < delta[1]:
1445 delta = delta2
1446 elif p2good:
1447 # If only p2 is good, use it
1448 delta = delta2
1449 elif p1good:
1450 pass
1451 else:
1452 # Neither is good, try against prev to hopefully save us
1453 # a fulltext.
1454 delta = builddelta(prev)
1455 else:
1456 # Pick whichever parent is closer to us (to minimize the
1439 # Pick whichever parent is closer to us (to minimize the
1457 # chance of having to build a fulltext). Since
1440 # chance of having to build a fulltext). Since
1458 # nullrev == -1, any non-merge commit will always pick p1r.
1441 # nullrev == -1, any non-merge commit will always pick p1r.
1459 drev = p2r if p2r > p1r else p1r
1442 parents = [max(parents)]
1460 delta = builddelta(drev)
1443 pdeltas = []
1461 # If the chosen delta will result in us making a full text,
1444 for p in parents:
1462 # give it one last try against prev.
1445 pd = builddelta(p)
1463 if drev != prev and not self._isgooddelta(delta, textlen):
1446 if self._isgooddelta(pd, textlen):
1464 delta = builddelta(prev)
1447 pdeltas.append(pd)
1448 if pdeltas:
1449 delta = min(pdeltas, key=lambda x: x[1])
1450 elif prev not in parents:
1451 # Neither is good, try against prev to hopefully save us
1452 # a fulltext.
1453 delta = builddelta(prev)
1465 else:
1454 else:
1466 delta = builddelta(prev)
1455 delta = builddelta(prev)
1467 if delta is not None:
1456 if delta is not None:
General Comments 0
You need to be logged in to leave comments. Login now