bundle: when forcing acceptance of incoming delta also accept snapshot
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 06 Dec 2022 12:10:31 +0100
changeset 49776 acdb9a15137c
parent 49775 d57b966cdeb1
child 49777 e1953a34c110
bundle: when forcing acceptance of incoming delta also accept snapshot Snapshot where never considered reusable and the unbundling side always tried to find a delta from them. In the `forced` mode this is counter-productive because it will either connect two delta-tree that should not be connected or it will spend potentially a lot of time because creating a full snapshot anyway. So in this mode, we accept the full snapshot as is. This changeset is benchmarked with its children so please do not split them apart when landing.
mercurial/revlogutils/deltas.py
--- a/mercurial/revlogutils/deltas.py	Wed Dec 07 20:05:19 2022 +0100
+++ b/mercurial/revlogutils/deltas.py	Tue Dec 06 12:10:31 2022 +0100
@@ -684,6 +684,15 @@
         yield None
         return
 
+    if (
+        cachedelta is not None
+        and nullrev == cachedelta[0]
+        and cachedelta[2] == DELTA_BASE_REUSE_FORCE
+    ):
+        # instruction are to forcibly do a full snapshot
+        yield None
+        return
+
     deltalength = revlog.length
     deltaparent = revlog.deltaparent
     sparse = revlog._sparserevlog