changeset 51325:c9ab452e5611

delta-find: check DELTA_BASE_REUSE_FORCE in the _DeltaSearch.__init__ Now that we have an object we can check that DELTA_BASE_REUSE_FORCE cases does not reach this code at in a more suitable location.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 20 Nov 2023 05:05:29 +0100
parents 047358417d01
children 01db705bbe32
files mercurial/revlogutils/deltas.py
diffstat 1 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlogutils/deltas.py	Mon Nov 20 05:04:23 2023 +0100
+++ b/mercurial/revlogutils/deltas.py	Mon Nov 20 05:05:29 2023 +0100
@@ -693,6 +693,14 @@
         target_rev=None,
         snapshot_cache=None,
     ):
+        # the DELTA_BASE_REUSE_FORCE case should have been taken care of sooner
+        # so we should never end up asking such question. Adding the assert as
+        # a safe-guard to detect anything that would be fishy in this regard.
+        assert (
+            cachedelta is None
+            or cachedelta[2] != DELTA_BASE_REUSE_FORCE
+            or not revlog.delta_config.general_delta
+        )
         self.revlog = revlog
         self.textlen = textlen
         self.p1 = p1
@@ -725,15 +733,6 @@
             yield None
             return
 
-        # the DELTA_BASE_REUSE_FORCE case should have been taken care of sooner
-        # so we should never end up asking such question. Adding the assert as
-        # a safe-guard to detect anything that would be fishy in this regard.
-        assert (
-            self.cachedelta is None
-            or self.cachedelta[2] != DELTA_BASE_REUSE_FORCE
-            or not self.revlog.delta_config.general_delta
-        )
-
         deltalength = self.revlog.length
         deltaparent = self.revlog.deltaparent
         sparse = self.revlog.delta_config.sparse_revlog