delta-find: gather the condition to blindly use a full snapshot together stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 08 Jun 2023 03:11:51 +0200
branchstable
changeset 50654 bfb6404089a5
parent 50653 f930b1b1d671
child 50655 485c9410b75a
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/
mercurial/revlogutils/deltas.py
--- 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)