diff mercurial/revlog.py @ 39156:b3b4bee161cf

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.
author Boris Feld <boris.feld@octobus.net>
date Mon, 23 Jul 2018 16:21:58 +0200
parents a43ef77cab1d
children a98e926b2f5b
line wrap: on
line diff
--- 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,