changeset 51323:87fce139e927

delta-find: move snapshot_cache in the _DeltaSearch.__init__ Now that we have an object we can initialize that attribute at initialization time.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 20 Nov 2023 05:03:21 +0100
parents a227e061bb4b
children 047358417d01
files mercurial/revlogutils/deltas.py
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlogutils/deltas.py	Mon Nov 20 04:59:25 2023 +0100
+++ b/mercurial/revlogutils/deltas.py	Mon Nov 20 05:03:21 2023 +0100
@@ -700,6 +700,9 @@
         self.cachedelta = cachedelta
         self.excluded_bases = excluded_bases
         self.target_rev = target_rev
+        if snapshot_cache is None:
+            # map: base-rev: [snapshot-revs]
+            snapshot_cache = SnapshotCache()
         self.snapshot_cache = snapshot_cache
 
     def candidate_groups(self):
@@ -886,8 +889,6 @@
                     debug_info['cached-delta.accepted'] += 1
                 yield None
                 return
-        if self.snapshot_cache is None:
-            self.snapshot_cache = SnapshotCache()
         groups = self._raw_groups()
         for candidates in groups:
             good = yield candidates
@@ -965,9 +966,6 @@
             yield parents
 
         if sparse and parents:
-            if self.snapshot_cache is None:
-                # map: base-rev: [snapshot-revs]
-                self.snapshot_cache = SnapshotCache()
             # See if we can use an existing snapshot in the parent chains to
             # use as a base for a new intermediate-snapshot
             #