changeset 51364:94fe4474b053

delta-find: move the emotion of prev in a dedicated method After splitting the filtering, and with the `_candidate_groups` layer removed, we can start splitting the group generation too. This helps to organize this code and make it easier to modifying the future.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 23 Nov 2023 21:44:51 +0100
parents 5cc04a6da19d
children fac6038b11f5
files mercurial/revlogutils/deltas.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlogutils/deltas.py	Thu Nov 23 21:51:43 2023 +0100
+++ b/mercurial/revlogutils/deltas.py	Thu Nov 23 21:44:51 2023 +0100
@@ -1074,6 +1074,12 @@
             # Test all parents (1 or 2), and keep the best candidate
             yield parents
 
+    def _iter_prev(self):
+        # other approach failed try against prev to hopefully save us a
+        # fulltext.
+        self.current_stage = _STAGE_PREV
+        yield (self.target_rev - 1,)
+
     def _refined_groups(self):
         good = None
         groups = self._raw_groups()
@@ -1221,10 +1227,7 @@
             yield tuple(sorted(full))
 
         if not sparse:
-            # other approach failed try against prev to hopefully save us a
-            # fulltext.
-            self.current_stage = _STAGE_PREV
-            yield (prev,)
+            yield from self._iter_prev()
 
 
 class SnapshotCache: