changeset 51324:047358417d01

delta-find: move target_rev 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:04:23 +0100
parents 87fce139e927
children c9ab452e5611
files mercurial/revlogutils/deltas.py
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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,)