Show More
@@ -726,9 +726,7 b' class _DeltaSearch:' | |||||
726 | """ |
|
726 | """ | |
727 | deltalength = self.revlog.length |
|
727 | deltalength = self.revlog.length | |
728 | deltaparent = self.revlog.deltaparent |
|
728 | deltaparent = self.revlog.deltaparent | |
729 | deltas_limit = self.revinfo.textlen * LIMIT_DELTA2TEXT |
|
|||
730 |
|
729 | |||
731 | sparse = self.revlog.delta_config.sparse_revlog |
|
|||
732 | tested = self.tested |
|
730 | tested = self.tested | |
733 | group = [] |
|
731 | group = [] | |
734 | for rev in temptative: |
|
732 | for rev in temptative: | |
@@ -736,43 +734,50 b' class _DeltaSearch:' | |||||
736 | while not (rev == nullrev or rev in tested or deltalength(rev)): |
|
734 | while not (rev == nullrev or rev in tested or deltalength(rev)): | |
737 | tested.add(rev) |
|
735 | tested.add(rev) | |
738 | rev = deltaparent(rev) |
|
736 | rev = deltaparent(rev) | |
|
737 | if self._pre_filter_rev(rev): | |||
|
738 | group.append(rev) | |||
|
739 | else: | |||
|
740 | self.tested.add(rev) | |||
|
741 | return group | |||
|
742 | ||||
|
743 | def _pre_filter_rev(self, rev): | |||
|
744 | """return True if it seems okay to test a rev, False otherwise""" | |||
|
745 | if True: | |||
739 | # no need to try a delta against nullrev, this will be done as |
|
746 | # no need to try a delta against nullrev, this will be done as | |
740 | # a last resort. |
|
747 | # a last resort. | |
741 | if rev == nullrev: |
|
748 | if rev == nullrev: | |
742 |
|
|
749 | return False | |
743 | # filter out revision we tested already |
|
750 | # filter out revision we tested already | |
744 | if rev in tested: |
|
751 | if rev in self.tested: | |
745 |
|
|
752 | return False | |
746 |
|
753 | |||
747 | # an higher authority deamed the base unworthy (e.g. censored) |
|
754 | # an higher authority deamed the base unworthy (e.g. censored) | |
748 | if self.excluded_bases is not None and rev in self.excluded_bases: |
|
755 | if self.excluded_bases is not None and rev in self.excluded_bases: | |
749 |
|
|
756 | return False | |
750 | continue |
|
|||
751 | # We are in some recomputation cases and that rev is too high |
|
757 | # We are in some recomputation cases and that rev is too high | |
752 | # in the revlog |
|
758 | # in the revlog | |
753 | if self.target_rev is not None and rev >= self.target_rev: |
|
759 | if self.target_rev is not None and rev >= self.target_rev: | |
754 |
|
|
760 | return False | |
755 | continue |
|
761 | ||
|
762 | deltas_limit = self.revinfo.textlen * LIMIT_DELTA2TEXT | |||
756 | # filter out delta base that will never produce good delta |
|
763 | # filter out delta base that will never produce good delta | |
757 | # |
|
764 | # | |
758 | # if the delta of that base is already bigger than the limit |
|
765 | # if the delta of that base is already bigger than the limit | |
759 | # for the delta chain size, doing a delta is hopeless. |
|
766 | # for the delta chain size, doing a delta is hopeless. | |
760 | if deltas_limit < self.revlog.length(rev): |
|
767 | if deltas_limit < self.revlog.length(rev): | |
761 |
|
|
768 | return False | |
762 | continue |
|
|||
763 |
|
769 | |||
|
770 | sparse = self.revlog.delta_config.sparse_revlog | |||
764 | # if the revision we test again is too small, the resulting delta |
|
771 | # if the revision we test again is too small, the resulting delta | |
765 | # will be large anyway as that amount of data to be added is big |
|
772 | # will be large anyway as that amount of data to be added is big | |
766 | if sparse and self.revlog.rawsize(rev) < ( |
|
773 | if sparse and self.revlog.rawsize(rev) < ( | |
767 | self.textlen // LIMIT_BASE2TEXT |
|
774 | self.textlen // LIMIT_BASE2TEXT | |
768 | ): |
|
775 | ): | |
769 |
|
|
776 | return False | |
770 | continue |
|
|||
771 |
|
777 | |||
772 | # no delta for rawtext-changing revs (see "candelta" for why) |
|
778 | # no delta for rawtext-changing revs (see "candelta" for why) | |
773 | if self.revlog.flags(rev) & REVIDX_RAWTEXT_CHANGING_FLAGS: |
|
779 | if self.revlog.flags(rev) & REVIDX_RAWTEXT_CHANGING_FLAGS: | |
774 |
|
|
780 | return False | |
775 | continue |
|
|||
776 |
|
781 | |||
777 | # If we reach here, we are about to build and test a delta. |
|
782 | # If we reach here, we are about to build and test a delta. | |
778 | # The delta building process will compute the chaininfo in all |
|
783 | # The delta building process will compute the chaininfo in all | |
@@ -784,12 +789,10 b' class _DeltaSearch:' | |||||
784 | self.revlog.delta_config.max_chain_len |
|
789 | self.revlog.delta_config.max_chain_len | |
785 | and chainlen >= self.revlog.delta_config.max_chain_len |
|
790 | and chainlen >= self.revlog.delta_config.max_chain_len | |
786 | ): |
|
791 | ): | |
787 |
|
|
792 | return False | |
788 | continue |
|
|||
789 | # if chain already have too much data, skip base |
|
793 | # if chain already have too much data, skip base | |
790 | if deltas_limit < chainsize: |
|
794 | if deltas_limit < chainsize: | |
791 |
|
|
795 | return False | |
792 | continue |
|
|||
793 | if sparse and self.revlog.delta_config.upper_bound_comp is not None: |
|
796 | if sparse and self.revlog.delta_config.upper_bound_comp is not None: | |
794 | maxcomp = self.revlog.delta_config.upper_bound_comp |
|
797 | maxcomp = self.revlog.delta_config.upper_bound_comp | |
795 | basenotsnap = (self.p1, self.p2, nullrev) |
|
798 | basenotsnap = (self.p1, self.p2, nullrev) | |
@@ -808,19 +811,15 b' class _DeltaSearch:' | |||||
808 | if snapshotlimit < lowestrealisticdeltalen: |
|
811 | if snapshotlimit < lowestrealisticdeltalen: | |
809 | # delta lower bound is larger than accepted upper |
|
812 | # delta lower bound is larger than accepted upper | |
810 | # bound |
|
813 | # bound | |
811 |
|
|
814 | return False | |
812 | continue |
|
|||
813 |
|
815 | |||
814 | # check the relative constraint on the delta size |
|
816 | # check the relative constraint on the delta size | |
815 | revlength = self.revlog.length(rev) |
|
817 | revlength = self.revlog.length(rev) | |
816 | if revlength < lowestrealisticdeltalen: |
|
818 | if revlength < lowestrealisticdeltalen: | |
817 | # delta probable lower bound is larger than target |
|
819 | # delta probable lower bound is larger than target | |
818 | # base |
|
820 | # base | |
819 |
|
|
821 | return False | |
820 | continue |
|
822 | return True | |
821 |
|
||||
822 | group.append(rev) |
|
|||
823 | return group |
|
|||
824 |
|
823 | |||
825 | def _refined_groups(self): |
|
824 | def _refined_groups(self): | |
826 | good = None |
|
825 | good = None |
General Comments 0
You need to be logged in to leave comments.
Login now