[PATCH 1 of 4] changegroup: if possible fallback to delta against parents instead of prev

Boris Feld boris.feld at octobus.net
Tue Oct 16 08:33:30 UTC 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1539114828 -7200
#      Tue Oct 09 21:53:48 2018 +0200
# Node ID a69790aaac1946e80e35b28c8f41b14a7f6c0f64
# Parent  43f0a37bd9ed20b45d73f667acbb0c3035492e1a
# EXP-Topic slim-bundle
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r a69790aaac19
changegroup: if possible fallback to delta against parents instead of prev

Deltas against parent are likely to be smaller. This is especially useful
since we stop reordering changeset in the bundle.

diff --git a/mercurial/utils/storageutil.py b/mercurial/utils/storageutil.py
--- a/mercurial/utils/storageutil.py
+++ b/mercurial/utils/storageutil.py
@@ -394,9 +394,11 @@ def emitrevisions(store, nodes, nodesord
                 baserev = nullrev
 
         # Storage has a fulltext revision.
-
-        # Let's use the previous revision, which is as good a guess as any.
-        # There is definitely room to improve this logic.
+        elif assumehaveparentrevisions and p1rev != nullrev:
+            baserev = p1rev
+        elif assumehaveparentrevisions and p2rev != nullrev:
+            baserev = p2rev
+        # revision is a root, try our luck against the previous revision
         elif prevrev is not None:
             baserev = prevrev
         else:


More information about the Mercurial-devel mailing list