sparse-revlog: only refine delta candidates in the sparse case (issue6006) stable
authorBoris Feld <boris.feld@octobus.net>
Wed, 31 Oct 2018 11:02:08 +0100
branchstable
changeset 40428 bafa1c4bb7a8
parent 40426 588f1e9a4d16
child 40429 14b6afc6cb28
sparse-revlog: only refine delta candidates in the sparse case (issue6006) Starting with 5aef5afa8654, a valid delta parent might be "refined". This allows repository using sparse-revlog to produce better delta chain by using better intermediate snapshot base. However, this refining step was performed in all cases, including for repository not using sparse-revlog. This could produce a strange chain in the general delta case and corrupted repository in the non-general delta case. We now skip this step unless sparse-revlog is in use. In issue 6006, Yuya Nishihara provided a test case using an external repository, so we did not include it. Finding "laboratory" condition to reproduce this case and implementing an efficient test reproducing it is a bit tricky. We do not foresee to have the time to provide one by the release date. Differential Revision: https://phab.mercurial-scm.org/D5197
mercurial/revlogutils/deltas.py
--- a/mercurial/revlogutils/deltas.py	Mon Oct 29 16:23:42 2018 -0400
+++ b/mercurial/revlogutils/deltas.py	Wed Oct 31 11:02:08 2018 +0100
@@ -646,6 +646,11 @@
         if good is not None:
             break
 
+    # If sparse revlog is enabled, we can try to refine the available deltas
+    if not revlog._sparserevlog:
+        yield None
+        return
+
     # if we have a refinable value, try to refine it
     if good is not None and good not in (p1, p2) and revlog.issnapshot(good):
         # refine snapshot down