delta-find: move tested in the _DeltaSearch.__init__
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 23 Nov 2023 01:13:40 +0100
changeset 51326 01db705bbe32
parent 51325 c9ab452e5611
child 51327 a4af7507fa4b
delta-find: move tested in the _DeltaSearch.__init__ Now that we have an object we can initialize that attribute at initialization time. This will make it available for more method in the future, allowing to split the code.
mercurial/revlogutils/deltas.py
--- a/mercurial/revlogutils/deltas.py	Mon Nov 20 05:05:29 2023 +0100
+++ b/mercurial/revlogutils/deltas.py	Thu Nov 23 01:13:40 2023 +0100
@@ -715,6 +715,8 @@
             snapshot_cache = SnapshotCache()
         self.snapshot_cache = snapshot_cache
 
+        self.tested = {nullrev}
+
     def candidate_groups(self):
         """Provides group of revision to be tested as delta base
 
@@ -741,7 +743,7 @@
         deltas_limit = self.textlen * LIMIT_DELTA2TEXT
         group_chunk_size = self.revlog.delta_config.candidate_group_chunk_size
 
-        tested = {nullrev}
+        tested = self.tested  # prefetch for speed and code compactness
         candidates = self._refined_groups()
         while True:
             temptative = candidates.send(good)