diff mercurial/revlogutils/deltas.py @ 49677:05db41701ece

find-delta: pass the cache-delta usage policy alongside the cache-delta The idea is to give higher level code more control to what will happens with the cache delta passed. This should help with controling how we treat delta's from different sources. The final goal of this change is to allow for server modes where the client can blindly accept any server delta without regards to any local constraints. This will be implemented in later changesets.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 07 Nov 2022 22:12:59 -0500
parents 0fca63953810
children efbbc2f9121e
line wrap: on
line diff
--- a/mercurial/revlogutils/deltas.py	Mon Nov 28 18:58:35 2022 +0100
+++ b/mercurial/revlogutils/deltas.py	Mon Nov 07 22:12:59 2022 -0500
@@ -20,6 +20,7 @@
     COMP_MODE_DEFAULT,
     COMP_MODE_INLINE,
     COMP_MODE_PLAIN,
+    DELTA_BASE_REUSE_NO,
     KIND_CHANGELOG,
     KIND_FILELOG,
     KIND_MANIFESTLOG,
@@ -819,7 +820,7 @@
     # through configuration. Disabling reuse source delta is useful when
     # we want to make sure we recomputed "optimal" deltas.
     debug_info = None
-    if cachedelta and revlog._generaldelta and revlog._lazydeltabase:
+    if cachedelta is not None and cachedelta[2] > DELTA_BASE_REUSE_NO:
         # Assume what we received from the server is a good choice
         # build delta will reuse the cache
         if debug_info is not None: