delta-find: move snapshot_cache in the _DeltaSearch.__init__
Now that we have an object we can initialize that attribute at initialization
time.
--- 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
#