# HG changeset patch # User Pierre-Yves David # Date 1686186711 -7200 # Node ID bfb6404089a588efe6384767cb7f2110053ae1b8 # Parent f930b1b1d671e9dc91a21f6340220c8097afb41c 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/ diff -r f930b1b1d671 -r bfb6404089a5 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)