Patchwork [09,of,10] sparse-revlog: ensure intermediate snapshot have decreasing size

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

Comments

Boris Feld - Aug. 16, 2018, 1:43 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1532355718 -7200
#      Mon Jul 23 16:21:58 2018 +0200
# Node ID ac0ba18eb49da2b7dc564afb1abec260cd1541d4
# Parent  4577a01129c513b870a70f52c071e1e668e94049
# EXP-Topic sparse-snapshot
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r ac0ba18eb49d
sparse-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.

Patch

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