changeset 39519:e4d4361d0bcd

snapshot: try to refine new snapshot base down the chain There are cases where doing a diff against a snapshot's parent will be shorter than against the snapshot itself. Reusing snapshot not directly related to the revision we are trying to store increase this odd. So once we found a possible candidate, we check the snapshots lower in the chain. This will involve extra processing, but this extra processing will only happen when we are doing building a snapshot, a rare situation.
author Boris Feld <boris.feld@octobus.net>
date Fri, 07 Sep 2018 11:17:35 -0400
parents 993d7e2c8b79
children 5aef5afa8654
files mercurial/revlogutils/deltas.py
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlogutils/deltas.py	Fri Sep 07 11:17:34 2018 -0400
+++ b/mercurial/revlogutils/deltas.py	Fri Sep 07 11:17:35 2018 -0400
@@ -647,6 +647,17 @@
         good = yield candidates
         if good is not None:
             break
+
+    # 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
+        previous = None
+        while previous != good:
+            previous = good
+            base = revlog.deltaparent(good)
+            if base == nullrev:
+                break
+            good = yield (base,)
     # we have found nothing
     yield None