Patchwork [08,of,10] sparse-revlog: bound number of snapshots in a chain

login
register
mail settings
Submitter Boris Feld
Date Aug. 16, 2018, 1:43 p.m.
Message ID <4577a01129c513b870a7.1534426995@FB-lair>
Download mbox | patch
Permalink /patch/33784/
State Accepted
Headers show

Comments

Boris Feld - Aug. 16, 2018, 1:43 p.m.
# HG changeset patch
# User Paul Morelle <paul.morelle@octobus.net>
# Date 1520422084 -3600
#      Wed Mar 07 12:28:04 2018 +0100
# Node ID 4577a01129c513b870a70f52c071e1e668e94049
# Parent  7417729eb852c6f88530d9659b0a82e3b450fcd4
# EXP-Topic sparse-snapshot
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 4577a01129c5
sparse-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.

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -2542,6 +2542,15 @@  class revlog(object):
         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,