Show More
@@ -569,9 +569,29 b' def isgooddeltainfo(revlog, deltainfo, r' | |||||
569 | return True |
|
569 | return True | |
570 |
|
570 | |||
571 | def _candidategroups(revlog, p1, p2, cachedelta): |
|
571 | def _candidategroups(revlog, p1, p2, cachedelta): | |
|
572 | """Provides group of revision to be tested as delta base | |||
|
573 | ||||
|
574 | This top level function focus on emitting groups with unique and worthwhile | |||
|
575 | content. See _raw_candidate_groups for details about the group order. | |||
572 |
|
|
576 | """ | |
573 | Provides revisions that present an interest to be diffed against, |
|
577 | # should we try to build a delta? | |
574 | grouped by level of easiness. |
|
578 | if not (len(revlog) and revlog._storedeltachains): | |
|
579 | return | |||
|
580 | ||||
|
581 | tested = set([nullrev]) | |||
|
582 | for group in _rawgroups(revlog, p1, p2, cachedelta): | |||
|
583 | group = tuple(r for r in group if r not in tested) | |||
|
584 | tested.update(group) | |||
|
585 | if group: | |||
|
586 | yield group | |||
|
587 | ||||
|
588 | def _rawgroups(revlog, p1, p2, cachedelta): | |||
|
589 | """Provides group of revision to be tested as delta base | |||
|
590 | ||||
|
591 | This lower level function focus on emitting delta theorically interresting | |||
|
592 | without looking it any practical details. | |||
|
593 | ||||
|
594 | The group order aims at providing fast or small candidates first. | |||
575 | """ |
|
595 | """ | |
576 | gdelta = revlog._generaldelta |
|
596 | gdelta = revlog._generaldelta | |
577 | curr = len(revlog) |
|
597 | curr = len(revlog) | |
@@ -590,29 +610,33 b' def _candidategroups(revlog, p1, p2, cac' | |||||
590 | yield (cachedelta[0],) |
|
610 | yield (cachedelta[0],) | |
591 | tested.add(cachedelta[0]) |
|
611 | tested.add(cachedelta[0]) | |
592 |
|
612 | |||
593 | if gdelta: |
|
613 | # This condition is true most of the time when processing | |
594 | # exclude already lazy tested base if any |
|
614 | # changegroup data into a generaldelta repo. The only time it | |
595 | parents = [p for p in (p1, p2) |
|
615 | # isn't true is if this is the first revision in a delta chain | |
596 | if p != nullrev and p not in tested] |
|
616 | # or if ``format.generaldelta=true`` disabled ``lazydeltabase``. | |
|
617 | if cachedelta and gdelta and revlog._lazydeltabase: | |||
|
618 | # Assume what we received from the server is a good choice | |||
|
619 | # build delta will reuse the cache | |||
|
620 | yield (cachedelta[0],) | |||
|
621 | ||||
|
622 | if gdelta: | |||
|
623 | # exclude already lazy tested base if any | |||
|
624 | parents = [p for p in (p1, p2) if p != nullrev] | |||
597 |
|
625 | |||
598 |
|
|
626 | if not revlog._deltabothparents and len(parents) == 2: | |
599 |
|
|
627 | parents.sort() | |
600 |
|
|
628 | # To minimize the chance of having to build a fulltext, | |
601 |
|
|
629 | # pick first whichever parent is closest to us (max rev) | |
602 |
|
|
630 | yield (parents[1],) | |
603 |
|
|
631 | # then the other one (min rev) if the first did not fit | |
604 |
|
|
632 | yield (parents[0],) | |
605 | tested.update(parents) |
|
633 | elif len(parents) > 0: | |
606 | elif len(parents) > 0: |
|
634 | # Test all parents (1 or 2), and keep the best candidate | |
607 | # Test all parents (1 or 2), and keep the best candidate |
|
635 | yield parents | |
608 | yield parents |
|
|||
609 | tested.update(parents) |
|
|||
610 |
|
636 | |||
611 | if prev not in tested: |
|
637 | # other approach failed try against prev to hopefully save us a | |
612 | # other approach failed try against prev to hopefully save us a |
|
638 | # fulltext. | |
613 | # fulltext. |
|
639 | yield (prev,) | |
614 | yield (prev,) |
|
|||
615 | tested.add(prev) |
|
|||
616 |
|
640 | |||
617 | class deltacomputer(object): |
|
641 | class deltacomputer(object): | |
618 | def __init__(self, revlog): |
|
642 | def __init__(self, revlog): |
General Comments 0
You need to be logged in to leave comments.
Login now