changeset 51370:99869dcf3ba0

delta-find: pass the full deltainfo to the _DeltaSearch class Having more information is better, so we pass it directly.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 23 Nov 2023 22:51:01 +0100
parents a224ce5694b3
children 508fd40dc86a
files mercurial/revlogutils/deltas.py
diffstat 1 files changed, 5 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlogutils/deltas.py	Sun Jan 07 05:20:00 2024 +0100
+++ b/mercurial/revlogutils/deltas.py	Thu Nov 23 22:51:01 2023 +0100
@@ -851,7 +851,7 @@
     def next_group(self, good_delta=None):
         old_good = self._last_good
         if good_delta is not None:
-            self._last_good = good_delta.base
+            self._last_good = good_delta
         if self.current_stage == _STAGE_CACHED and good_delta is not None:
             # the cache is good, let us use the cache as requested
             self._candidates_iterator = None
@@ -1213,28 +1213,24 @@
             if good is not None:
                 break
         # if we have a refinable value, try to refine it
-        if (
-            good is not None
-            and good not in (self.p1, self.p2)
-            and self.revlog.issnapshot(good)
-        ):
+        if good is not None and good.snapshotdepth is not None:
             assert self.current_stage == _STAGE_SNAPSHOT
             # refine snapshot down
             previous = None
             while previous != good:
                 previous = good
-                base = self.revlog.deltaparent(good)
+                base = self.revlog.deltaparent(good.base)
                 if base == nullrev:
                     break
                 good = yield (base,)
             # refine snapshot up
             if not self.snapshot_cache.snapshots:
-                self.snapshot_cache.update(self.revlog, good + 1)
+                self.snapshot_cache.update(self.revlog, good.base + 1)
             previous = None
             while good != previous:
                 previous = good
                 children = tuple(
-                    sorted(c for c in self.snapshot_cache.snapshots[good])
+                    sorted(c for c in self.snapshot_cache.snapshots[good.base])
                 )
                 good = yield children
         yield None