changeset 50383:bfb6404089a5 stable

delta-find: gather the condition to blindly use a full snapshot together We are about to make the `if` body bigger, so having only one of them is simpler/
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 08 Jun 2023 03:11:51 +0200
parents f930b1b1d671
children 485c9410b75a
files mercurial/revlogutils/deltas.py
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlogutils/deltas.py	Thu Jun 08 02:49:10 2023 +0200
+++ b/mercurial/revlogutils/deltas.py	Thu Jun 08 03:11:51 2023 +0200
@@ -1296,18 +1296,17 @@
             dbg['p1-chain-len'] = p1_chain_len
             dbg['p2-chain-len'] = p2_chain_len
 
-        if not revinfo.textlen:
+        # 1) if the revision is empty, no amount of delta can beat it
+        #
+        # 2) no delta for flag processor revision (see "candelta" for why)
+        # not calling candelta since only one revision needs test, also to
+        # avoid overhead fetching flags again.
+        if not revinfo.textlen or revinfo.flags & REVIDX_RAWTEXT_CHANGING_FLAGS:
             return self._fullsnapshotinfo(fh, revinfo, target_rev)
 
         if excluded_bases is None:
             excluded_bases = set()
 
-        # no delta for flag processor revision (see "candelta" for why)
-        # not calling candelta since only one revision needs test, also to
-        # avoid overhead fetching flags again.
-        if revinfo.flags & REVIDX_RAWTEXT_CHANGING_FLAGS:
-            return self._fullsnapshotinfo(fh, revinfo, target_rev)
-
         # count the number of different delta we tried (for debug purpose)
         dbg_try_count = 0
         # count the number of "search round" we did. (for debug purpose)