diff mercurial/revlog.py @ 39155:a43ef77cab1d

revlog: bound number of snapshots in a chain To limit the number of snapshot chained, we enforce them to be smaller and smaller. This guarantee the number of snapshot in a chain will be bounded to a small number.
author Paul Morelle <paul.morelle@octobus.net>
date Wed, 07 Mar 2018 12:28:04 +0100
parents e0da43e2f71f
children b3b4bee161cf
line wrap: on
line diff
--- a/mercurial/revlog.py	Fri Jul 20 14:32:56 2018 +0200
+++ b/mercurial/revlog.py	Wed Mar 07 12:28:04 2018 +0100
@@ -2557,6 +2557,15 @@
         if self._maxchainlen and  self._maxchainlen < deltainfo.chainlen:
             return False
 
+        # bad delta from intermediate snapshot size limit
+        #
+        #   If an intermediate snapshot size is higher than the limit.  The
+        #   limit exist to prevent endless chain of intermediate delta to be
+        #   created.
+        if (deltainfo.snapshotdepth is not None and
+                (textlen >> deltainfo.snapshotdepth) < deltainfo.deltalen):
+            return False
+
         return True
 
     def _addrevision(self, node, rawtext, transaction, link, p1, p2, flags,