comparison mercurial/revlogutils/deltas.py @ 39520:5aef5afa8654

snapshot: refine candidate snapshot base upward Once we found a suitable snapshot base it is useful to check if it has a "children" snapshot that would provide a better diff. This is useful when base not directly related to stored revision are picked. In those case, we "jumped" to this new chain at an arbitrary point, checking if a higher point is more appropriate will help to provide better results and increase snapshot reuse.
author Boris Feld <boris.feld@octobus.net>
date Fri, 07 Sep 2018 11:17:36 -0400
parents e4d4361d0bcd
children 05a165dc4f55
comparison
equal deleted inserted replaced
39519:e4d4361d0bcd 39520:5aef5afa8654
656 previous = good 656 previous = good
657 base = revlog.deltaparent(good) 657 base = revlog.deltaparent(good)
658 if base == nullrev: 658 if base == nullrev:
659 break 659 break
660 good = yield (base,) 660 good = yield (base,)
661 # refine snapshot up
662 #
663 # XXX the _findsnapshots call can be expensive and is "duplicated" with
664 # the one done in `_rawgroups`. Once we start working on performance,
665 # we should make the two logics share this computation.
666 snapshots = collections.defaultdict(list)
667 _findsnapshots(revlog, snapshots, good + 1)
668 previous = None
669 while good != previous:
670 previous = good
671 children = tuple(sorted(c for c in snapshots[good]))
672 good = yield children
673
661 # we have found nothing 674 # we have found nothing
662 yield None 675 yield None
663 676
664 def _rawgroups(revlog, p1, p2, cachedelta): 677 def _rawgroups(revlog, p1, p2, cachedelta):
665 """Provides group of revision to be tested as delta base 678 """Provides group of revision to be tested as delta base