delta-find: move target_rev in the _DeltaSearch.__init__
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 20 Nov 2023 05:04:23 +0100
changeset 51324 047358417d01
parent 51323 87fce139e927
child 51325 c9ab452e5611
delta-find: move target_rev in the _DeltaSearch.__init__ Now that we have an object we can initialize that attribute at initialization time.
mercurial/revlogutils/deltas.py
--- a/mercurial/revlogutils/deltas.py	Mon Nov 20 05:03:21 2023 +0100
+++ b/mercurial/revlogutils/deltas.py	Mon Nov 20 05:04:23 2023 +0100
@@ -699,6 +699,8 @@
         self.p2 = p2
         self.cachedelta = cachedelta
         self.excluded_bases = excluded_bases
+        if target_rev is None:
+            self.target_rev = len(self.revlog)
         self.target_rev = target_rev
         if snapshot_cache is None:
             # map: base-rev: [snapshot-revs]
@@ -717,9 +719,6 @@
             yield None
             return
 
-        if self.target_rev is None:
-            self.target_rev = len(self.revlog)
-
         if not self.revlog.delta_config.general_delta:
             # before general delta, there is only one possible delta base
             yield (self.target_rev - 1,)