Patchwork [05,of,10] deltas: skip if projected delta size is bigger than previous snapshot

login
register
mail settings
Submitter Pierre-Yves David
Date June 13, 2019, 1:23 p.m.
Message ID <c1659d13be5380866191.1560432180@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/40474/
State Accepted
Headers show

Comments

Patch

diff --git a/mercurial/revlogutils/deltas.py b/mercurial/revlogutils/deltas.py
--- a/mercurial/revlogutils/deltas.py
+++ b/mercurial/revlogutils/deltas.py
@@ -698,6 +698,12 @@  def _candidategroups(revlog, textlen, p1
                         # delta lower bound is larger than accepted upper bound
                         continue
 
+                    # check the relative constraint on the delta size
+                    revlength = revlog.length(rev)
+                    if revlength < lowestrealisticdeltalen:
+                        # delta probable lower bound is larger than target base
+                        continue
+
             group.append(rev)
         if group:
             # XXX: in the sparse revlog case, group can become large,