mercurial/revlogutils/deltas.py
changeset 49879 bcae90c53def
parent 49795 c261a628e525
child 49885 d57b966cdeb1
--- a/mercurial/revlogutils/deltas.py	Sat Dec 03 01:24:34 2022 +0100
+++ b/mercurial/revlogutils/deltas.py	Mon Nov 07 22:30:30 2022 -0500
@@ -20,6 +20,7 @@
     COMP_MODE_DEFAULT,
     COMP_MODE_INLINE,
     COMP_MODE_PLAIN,
+    DELTA_BASE_REUSE_FORCE,
     DELTA_BASE_REUSE_NO,
     KIND_CHANGELOG,
     KIND_FILELOG,
@@ -584,6 +585,13 @@
     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
+
     # - 'deltainfo.distance' is the distance from the base revision --
     #   bounding it limits the amount of I/O we need to do.
     # - 'deltainfo.compresseddeltalen' is the sum of the total size of
@@ -711,6 +719,16 @@
             # filter out revision we tested already
             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)