delta-find: pass the full deltainfo to the _DeltaSearch class
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 23 Nov 2023 22:51:01 +0100
changeset 51360 99869dcf3ba0
parent 51359 a224ce5694b3
child 51369 508fd40dc86a
delta-find: pass the full deltainfo to the _DeltaSearch class Having more information is better, so we pass it directly.
mercurial/revlogutils/deltas.py
--- 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