changeset 51341:176d530f59af

delta-find: move delta size check earlier in is_good_delta_info This will clarify future patches by regrouping related logic before larger movement.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 04 Jan 2024 15:35:36 +0100
parents 1ea56b10dd4a
children 410afe5b13fc
files mercurial/revlogutils/deltas.py
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlogutils/deltas.py	Thu Jan 04 15:04:10 2024 +0100
+++ b/mercurial/revlogutils/deltas.py	Thu Jan 04 15:35:36 2024 +0100
@@ -1057,6 +1057,13 @@
             or not self.revlog.delta_config.general_delta
         )
 
+        # Bad delta from new delta size:
+        #
+        #   If the delta size is larger than the target text, storing the delta
+        #   will be inefficient.
+        if self.revinfo.textlen < deltainfo.deltalen:
+            return False
+
         # - '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
@@ -1085,13 +1092,6 @@
         ):
             return False
 
-        # Bad delta from new delta size:
-        #
-        #   If the delta size is larger than the target text, storing the delta
-        #   will be inefficient.
-        if textlen < deltainfo.deltalen:
-            return False
-
         # Bad delta from cumulated payload size:
         #
         #   If the sum of delta get larger than K * target text length.