diff mercurial/exchangev2.py @ 39641:aa7e312375cf

wireprotov2: let clients drive delta behavior Previously, the "manifestdata" and "filedata" commands assumed the receiver had all parent revisions for requested nodes. Unless the revision had no parents, they emitted a delta instead of a fulltext. This strategy isn't appropriate for shallow clones and for clients that only want to access fulltext revision data for a single node without fetching their parent revisions. This commit adds an "haveparents" argument to the "manifestdata" and "filedata" commands that controls delta generation behavior. Unless "haveparents" is set, the server assumes that the client doesn't have parent revisions unless they were previously sent as part of the current group of revisions. This change allows the fulltext revision data of any individual revision to be obtained. This will facilitate shallow clones and other data retrieval strategies that don't require all previous revisions of an entity to be fetched. Differential Revision: https://phab.mercurial-scm.org/D4492
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 30 Aug 2018 14:55:34 -0700
parents 039bf1eddc2e
children d059cb669632
line wrap: on
line diff
--- a/mercurial/exchangev2.py	Tue Sep 04 10:42:24 2018 -0700
+++ b/mercurial/exchangev2.py	Thu Aug 30 14:55:34 2018 -0700
@@ -283,6 +283,7 @@
                 b'tree': b'',
                 b'nodes': batch,
                 b'fields': {b'parents', b'revision'},
+                b'haveparents': True,
             }).result()
 
             # Chomp off header object.
@@ -374,7 +375,8 @@
                 fs.append((path, e.callcommand(b'filedata', {
                     b'path': path,
                     b'nodes': sorted(nodes),
-                    b'fields': {b'parents', b'revision'}
+                    b'fields': {b'parents', b'revision'},
+                    b'haveparents': True,
                 })))
 
                 locallinkrevs[path] = {