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

login
register
mail settings
Submitter Pierre-Yves David
Date June 13, 2019, 1:23 p.m.
Message ID <2cf494071b512e698775.1560432184@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/40477/
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
@@ -966,6 +966,8 @@  class deltacomputer(object):
             snapshotlimit = revinfo.textlen >> snapshotdepth
             if snapshotlimit < lowestrealisticdeltalen:
                 return None
+            if revlog.length(base) < lowestrealisticdeltalen:
+                return None
         header, data = revlog.compress(delta)
         deltalen = len(header) + len(data)
         offset = revlog.end(len(revlog) - 1)