Show More
@@ -767,42 +767,20 b' class _DeltaSearch:' | |||||
767 | return False |
|
767 | return False | |
768 | return True |
|
768 | return True | |
769 |
|
769 | |||
770 | def _pre_filter_rev(self, rev): |
|
770 | def _pre_filter_rev_sparse(self, rev): | |
771 | """return True if it seems okay to test a rev, False otherwise""" |
|
771 | """pre filtering that is needed in sparse revlog cases | |
772 | if not self._pre_filter_rev_universal(rev): |
|
|||
773 | return False |
|
|||
774 |
|
|
772 | ||
775 | deltas_limit = self.revinfo.textlen * LIMIT_DELTA2TEXT |
|
773 | return True if it seems okay to test a rev, False otherwise. | |
776 | # filter out delta base that will never produce good delta |
|
|||
777 | # |
|
|||
778 | # if the delta of that base is already bigger than the limit |
|
|||
779 | # for the delta chain size, doing a delta is hopeless. |
|
|||
780 | if deltas_limit < self.revlog.length(rev): |
|
|||
781 | return False |
|
|||
782 |
|
|
774 | ||
783 | sparse = self.revlog.delta_config.sparse_revlog |
|
775 | used by _pre_filter_rev. | |
|
776 | """ | |||
|
777 | assert self.revlog.delta_config.sparse_revlog | |||
784 | # if the revision we test again is too small, the resulting delta |
|
778 | # if the revision we test again is too small, the resulting delta | |
785 | # will be large anyway as that amount of data to be added is big |
|
779 | # will be large anyway as that amount of data to be added is big | |
786 |
if |
|
780 | if self.revlog.rawsize(rev) < (self.textlen // LIMIT_BASE2TEXT): | |
787 | self.textlen // LIMIT_BASE2TEXT |
|
|||
788 | ): |
|
|||
789 | return False |
|
781 | return False | |
790 |
|
782 | |||
791 | # If we reach here, we are about to build and test a delta. |
|
783 | if self.revlog.delta_config.upper_bound_comp is not None: | |
792 | # The delta building process will compute the chaininfo in all |
|
|||
793 | # case, since that computation is cached, it is fine to access |
|
|||
794 | # it here too. |
|
|||
795 | chainlen, chainsize = self.revlog._chaininfo(rev) |
|
|||
796 | # if chain will be too long, skip base |
|
|||
797 | if ( |
|
|||
798 | self.revlog.delta_config.max_chain_len |
|
|||
799 | and chainlen >= self.revlog.delta_config.max_chain_len |
|
|||
800 | ): |
|
|||
801 | return False |
|
|||
802 | # if chain already have too much data, skip base |
|
|||
803 | if deltas_limit < chainsize: |
|
|||
804 | return False |
|
|||
805 | if sparse and self.revlog.delta_config.upper_bound_comp is not None: |
|
|||
806 | maxcomp = self.revlog.delta_config.upper_bound_comp |
|
784 | maxcomp = self.revlog.delta_config.upper_bound_comp | |
807 | basenotsnap = (self.p1, self.p2, nullrev) |
|
785 | basenotsnap = (self.p1, self.p2, nullrev) | |
808 | if rev not in basenotsnap and self.revlog.issnapshot(rev): |
|
786 | if rev not in basenotsnap and self.revlog.issnapshot(rev): | |
@@ -830,6 +808,40 b' class _DeltaSearch:' | |||||
830 | return False |
|
808 | return False | |
831 | return True |
|
809 | return True | |
832 |
|
810 | |||
|
811 | def _pre_filter_rev(self, rev): | |||
|
812 | """return True if it seems okay to test a rev, False otherwise""" | |||
|
813 | if not self._pre_filter_rev_universal(rev): | |||
|
814 | return False | |||
|
815 | ||||
|
816 | deltas_limit = self.revinfo.textlen * LIMIT_DELTA2TEXT | |||
|
817 | # filter out delta base that will never produce good delta | |||
|
818 | # | |||
|
819 | # if the delta of that base is already bigger than the limit | |||
|
820 | # for the delta chain size, doing a delta is hopeless. | |||
|
821 | if deltas_limit < self.revlog.length(rev): | |||
|
822 | return False | |||
|
823 | ||||
|
824 | # If we reach here, we are about to build and test a delta. | |||
|
825 | # The delta building process will compute the chaininfo in all | |||
|
826 | # case, since that computation is cached, it is fine to access | |||
|
827 | # it here too. | |||
|
828 | chainlen, chainsize = self.revlog._chaininfo(rev) | |||
|
829 | # if chain will be too long, skip base | |||
|
830 | if ( | |||
|
831 | self.revlog.delta_config.max_chain_len | |||
|
832 | and chainlen >= self.revlog.delta_config.max_chain_len | |||
|
833 | ): | |||
|
834 | return False | |||
|
835 | # if chain already have too much data, skip base | |||
|
836 | if deltas_limit < chainsize: | |||
|
837 | return False | |||
|
838 | ||||
|
839 | if self.revlog.delta_config.sparse_revlog: | |||
|
840 | if not self._pre_filter_rev_sparse(rev): | |||
|
841 | return False | |||
|
842 | ||||
|
843 | return True | |||
|
844 | ||||
833 | def _refined_groups(self): |
|
845 | def _refined_groups(self): | |
834 | good = None |
|
846 | good = None | |
835 | # First we try to reuse a the delta contained in the bundle. (or from |
|
847 | # First we try to reuse a the delta contained in the bundle. (or from |
General Comments 0
You need to be logged in to leave comments.
Login now