delta-find: check DELTA_BASE_REUSE_FORCE in the _DeltaSearch.__init__
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 20 Nov 2023 05:05:29 +0100
changeset 51325 c9ab452e5611
parent 51324 047358417d01
child 51326 01db705bbe32
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.
mercurial/revlogutils/deltas.py
--- 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