delta-find: remove dead code intended to deal with forced delta reuse
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 18 Jun 2023 00:04:53 +0200
changeset 50698 f1b57672cb94
parent 50697 e7ef11b75fdc
child 50699 2aaabd8f4471
delta-find: remove dead code intended to deal with forced delta reuse Since the case was dealt with sooner (see XXX), we no longer need to deal with it in this part of the code.
mercurial/revlogutils/deltas.py
--- 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)