Mercurial > public > mercurial-scm > hg
comparison mercurial/revlogutils/deltas.py @ 49615:4956942c0416
delta-find: adjust the moment when we mark something as "tested"
In a coming change, not all elements of `group` might get tested. So we need to
have more control about when a revision is actually added to the `tested` set.
So we move to a more verbose (and more fragile) version.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 06 Nov 2022 15:03:31 -0500 |
parents | 01ccb45b7393 |
children | f5f113f1b011 |
comparison
equal
deleted
inserted
replaced
49614:01ccb45b7393 | 49615:4956942c0416 |
---|---|
705 if rev == nullrev: | 705 if rev == nullrev: |
706 continue | 706 continue |
707 # filter out revision we tested already | 707 # filter out revision we tested already |
708 if rev in tested: | 708 if rev in tested: |
709 continue | 709 continue |
710 tested.add(rev) | |
711 # an higher authority deamed the base unworthy (e.g. censored) | 710 # an higher authority deamed the base unworthy (e.g. censored) |
712 if excluded_bases is not None and rev in excluded_bases: | 711 if excluded_bases is not None and rev in excluded_bases: |
712 tested.add(rev) | |
713 continue | 713 continue |
714 # We are in some recomputation cases and that rev is too high in | 714 # We are in some recomputation cases and that rev is too high in |
715 # the revlog | 715 # the revlog |
716 if target_rev is not None and rev >= target_rev: | 716 if target_rev is not None and rev >= target_rev: |
717 tested.add(rev) | |
717 continue | 718 continue |
718 # filter out delta base that will never produce good delta | 719 # filter out delta base that will never produce good delta |
719 if deltas_limit < revlog.length(rev): | 720 if deltas_limit < revlog.length(rev): |
721 tested.add(rev) | |
720 continue | 722 continue |
721 if sparse and revlog.rawsize(rev) < (textlen // LIMIT_BASE2TEXT): | 723 if sparse and revlog.rawsize(rev) < (textlen // LIMIT_BASE2TEXT): |
724 tested.add(rev) | |
722 continue | 725 continue |
723 # no delta for rawtext-changing revs (see "candelta" for why) | 726 # no delta for rawtext-changing revs (see "candelta" for why) |
724 if revlog.flags(rev) & REVIDX_RAWTEXT_CHANGING_FLAGS: | 727 if revlog.flags(rev) & REVIDX_RAWTEXT_CHANGING_FLAGS: |
728 tested.add(rev) | |
725 continue | 729 continue |
726 | 730 |
727 # If we reach here, we are about to build and test a delta. | 731 # If we reach here, we are about to build and test a delta. |
728 # The delta building process will compute the chaininfo in all | 732 # The delta building process will compute the chaininfo in all |
729 # case, since that computation is cached, it is fine to access it | 733 # case, since that computation is cached, it is fine to access it |
730 # here too. | 734 # here too. |
731 chainlen, chainsize = revlog._chaininfo(rev) | 735 chainlen, chainsize = revlog._chaininfo(rev) |
732 # if chain will be too long, skip base | 736 # if chain will be too long, skip base |
733 if revlog._maxchainlen and chainlen >= revlog._maxchainlen: | 737 if revlog._maxchainlen and chainlen >= revlog._maxchainlen: |
738 tested.add(rev) | |
734 continue | 739 continue |
735 # if chain already have too much data, skip base | 740 # if chain already have too much data, skip base |
736 if deltas_limit < chainsize: | 741 if deltas_limit < chainsize: |
742 tested.add(rev) | |
737 continue | 743 continue |
738 if sparse and revlog.upperboundcomp is not None: | 744 if sparse and revlog.upperboundcomp is not None: |
739 maxcomp = revlog.upperboundcomp | 745 maxcomp = revlog.upperboundcomp |
740 basenotsnap = (p1, p2, nullrev) | 746 basenotsnap = (p1, p2, nullrev) |
741 if rev not in basenotsnap and revlog.issnapshot(rev): | 747 if rev not in basenotsnap and revlog.issnapshot(rev): |
750 | 756 |
751 # check the absolute constraint on the delta size | 757 # check the absolute constraint on the delta size |
752 snapshotlimit = textlen >> snapshotdepth | 758 snapshotlimit = textlen >> snapshotdepth |
753 if snapshotlimit < lowestrealisticdeltalen: | 759 if snapshotlimit < lowestrealisticdeltalen: |
754 # delta lower bound is larger than accepted upper bound | 760 # delta lower bound is larger than accepted upper bound |
761 tested.add(rev) | |
755 continue | 762 continue |
756 | 763 |
757 # check the relative constraint on the delta size | 764 # check the relative constraint on the delta size |
758 revlength = revlog.length(rev) | 765 revlength = revlog.length(rev) |
759 if revlength < lowestrealisticdeltalen: | 766 if revlength < lowestrealisticdeltalen: |
760 # delta probable lower bound is larger than target base | 767 # delta probable lower bound is larger than target base |
768 tested.add(rev) | |
761 continue | 769 continue |
762 | 770 |
763 group.append(rev) | 771 group.append(rev) |
764 if group: | 772 if group: |
765 # XXX: in the sparse revlog case, group can become large, | 773 # XXX: in the sparse revlog case, group can become large, |
766 # impacting performances. Some bounding or slicing mecanism | 774 # impacting performances. Some bounding or slicing mecanism |
767 # would help to reduce this impact. | 775 # would help to reduce this impact. |
776 tested.update(group) | |
768 good = yield tuple(group) | 777 good = yield tuple(group) |
769 yield None | 778 yield None |
770 | 779 |
771 | 780 |
772 def _findsnapshots(revlog, cache, start_rev): | 781 def _findsnapshots(revlog, cache, start_rev): |