delta-find: move delta size check earlier in is_good_delta_info
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 04 Jan 2024 15:35:36 +0100
changeset 51341 176d530f59af
parent 51340 1ea56b10dd4a
child 51342 410afe5b13fc
delta-find: move delta size check earlier in is_good_delta_info This will clarify future patches by regrouping related logic before larger movement.
mercurial/revlogutils/deltas.py
--- 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.