comparison mercurial/revlogutils/deltas.py @ 39502:e4d4361d0bcd

snapshot: try to refine new snapshot base down the chain There are cases where doing a diff against a snapshot's parent will be shorter than against the snapshot itself. Reusing snapshot not directly related to the revision we are trying to store increase this odd. So once we found a possible candidate, we check the snapshots lower in the chain. This will involve extra processing, but this extra processing will only happen when we are doing building a snapshot, a rare situation.
author Boris Feld <boris.feld@octobus.net>
date Fri, 07 Sep 2018 11:17:35 -0400
parents 993d7e2c8b79
children 5aef5afa8654
comparison
equal deleted inserted replaced
39501:993d7e2c8b79 39502:e4d4361d0bcd
645 return 645 return
646 for candidates in _rawgroups(revlog, p1, p2, cachedelta): 646 for candidates in _rawgroups(revlog, p1, p2, cachedelta):
647 good = yield candidates 647 good = yield candidates
648 if good is not None: 648 if good is not None:
649 break 649 break
650
651 # if we have a refinable value, try to refine it
652 if good is not None and good not in (p1, p2) and revlog.issnapshot(good):
653 # refine snapshot down
654 previous = None
655 while previous != good:
656 previous = good
657 base = revlog.deltaparent(good)
658 if base == nullrev:
659 break
660 good = yield (base,)
650 # we have found nothing 661 # we have found nothing
651 yield None 662 yield None
652 663
653 def _rawgroups(revlog, p1, p2, cachedelta): 664 def _rawgroups(revlog, p1, p2, cachedelta):
654 """Provides group of revision to be tested as delta base 665 """Provides group of revision to be tested as delta base