mercurial/revlogutils/deltas.py
changeset 50695 f1b57672cb94
parent 50683 a41eeb877d07
child 50925 d718eddf01d9
--- a/mercurial/revlogutils/deltas.py	Thu Apr 20 15:56:58 2023 -0400
+++ b/mercurial/revlogutils/deltas.py	Sun Jun 18 00:04:53 2023 +0200
@@ -585,12 +585,14 @@
     if deltainfo is None:
         return False
 
-    if (
-        revinfo.cachedelta is not None
-        and deltainfo.base == revinfo.cachedelta[0]
-        and revinfo.cachedelta[2] == DELTA_BASE_REUSE_FORCE
-    ):
-        return True
+    # 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 (
+        revinfo.cachedelta is None
+        or revinfo.cachedelta[2] != DELTA_BASE_REUSE_FORCE
+        or not revlog._generaldelta
+    )
 
     # - 'deltainfo.distance' is the distance from the base revision --
     #   bounding it limits the amount of I/O we need to do.
@@ -693,14 +695,14 @@
         yield None
         return
 
-    if (
-        cachedelta is not None
-        and nullrev == cachedelta[0]
-        and cachedelta[2] == DELTA_BASE_REUSE_FORCE
-    ):
-        # instruction are to forcibly do a full snapshot
-        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 (
+        cachedelta is None
+        or cachedelta[2] != DELTA_BASE_REUSE_FORCE
+        or not revlog._generaldelta
+    )
 
     deltalength = revlog.length
     deltaparent = revlog.deltaparent
@@ -736,15 +738,6 @@
             if rev in tested:
                 continue
 
-            if (
-                cachedelta is not None
-                and rev == cachedelta[0]
-                and cachedelta[2] == DELTA_BASE_REUSE_FORCE
-            ):
-                # instructions are to forcibly consider/use this delta base
-                group.append(rev)
-                continue
-
             # an higher authority deamed the base unworthy (e.g. censored)
             if excluded_bases is not None and rev in excluded_bases:
                 tested.add(rev)