changeset 51350:1ea56b10dd4a

delta-find: split the delta-chain part of `_pre_filter_rev` in a method Since `_pre_filter_rev` contains logic from various sources of constraint, we start splitting is in subfunction to clarify and document the grouping.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 04 Jan 2024 15:04:10 +0100
parents 9a1239c362ae
children 176d530f59af
files mercurial/revlogutils/deltas.py
diffstat 1 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlogutils/deltas.py	Thu Jan 04 14:51:48 2024 +0100
+++ b/mercurial/revlogutils/deltas.py	Thu Jan 04 15:04:10 2024 +0100
@@ -808,11 +808,13 @@
                     return False
         return True
 
-    def _pre_filter_rev(self, rev):
-        """return True if it seems okay to test a rev, False otherwise"""
-        if not self._pre_filter_rev_universal(rev):
-            return False
+    def _pre_filter_rev_delta_chain(self, rev):
+        """pre filtering that is needed in sparse revlog cases
 
+        return True if it seems okay to test a rev, False otherwise.
+
+        used by _pre_filter_rev.
+        """
         deltas_limit = self.revinfo.textlen * LIMIT_DELTA2TEXT
         # filter out delta base that will never produce good delta
         #
@@ -835,7 +837,14 @@
         # if chain already have too much data, skip base
         if deltas_limit < chainsize:
             return False
+        return True
 
+    def _pre_filter_rev(self, rev):
+        """return True if it seems okay to test a rev, False otherwise"""
+        if not self._pre_filter_rev_universal(rev):
+            return False
+        if not self._pre_filter_rev_delta_chain(rev):
+            return False
         if self.revlog.delta_config.sparse_revlog:
             if not self._pre_filter_rev_sparse(rev):
                 return False