revlog: ensure intermediate snapshot have decreasing size
authorBoris Feld <boris.feld@octobus.net>
Mon, 23 Jul 2018 16:21:58 +0200
changeset 39156 b3b4bee161cf
parent 39155 a43ef77cab1d
child 39157 a98e926b2f5b
revlog: ensure intermediate snapshot have decreasing size If the intermediate snapshot is bigger than the previous one, there is likely a better snapshot to be made at a different level.
mercurial/revlog.py
--- a/mercurial/revlog.py	Wed Mar 07 12:28:04 2018 +0100
+++ b/mercurial/revlog.py	Mon Jul 23 16:21:58 2018 +0200
@@ -2566,6 +2566,12 @@
                 (textlen >> deltainfo.snapshotdepth) < deltainfo.deltalen):
             return False
 
+        # bad delta if new intermediate snapshot is larger than the previous
+        # snapshot
+        if (deltainfo.snapshotdepth
+                and self.length(deltainfo.base) < deltainfo.deltalen):
+            return False
+
         return True
 
     def _addrevision(self, node, rawtext, transaction, link, p1, p2, flags,