revlog: bound number of snapshots in a chain
authorPaul Morelle <paul.morelle@octobus.net>
Wed, 07 Mar 2018 12:28:04 +0100
changeset 39155 a43ef77cab1d
parent 39154 e0da43e2f71f
child 39156 b3b4bee161cf
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.
mercurial/revlog.py
--- 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,