D4492: wireprotov2: let clients drive delta behavior
This revision was automatically updated to reflect the committed changes. Closed by commit rHGaa7e312375cf: wireprotov2: let clients drive delta behavior (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4492?vs=10971=11070 REVISION DETAIL https://phab.mercurial-scm.org/D4492 AFFECTED FILES mercurial/exchangev2.py mercurial/help/internals/wireprotocolv2.txt mercurial/wireprotov2server.py tests/test-http-protocol.t tests/test-wireproto-command-capabilities.t tests/test-wireproto-command-filedata.t tests/test-wireproto-command-manifestdata.t tests/test-wireproto-exchangev2.t CHANGE DETAILS diff --git a/tests/test-wireproto-exchangev2.t b/tests/test-wireproto-exchangev2.t --- a/tests/test-wireproto-exchangev2.t +++ b/tests/test-wireproto-exchangev2.t @@ -82,6 +82,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '\x99/Gy\x02\x9a=\xf8\xd0fm\x00\xbb\x92OicN', '\xa9\x88\xfbCX>\x87\x1d\x1e\xd5u\x0e\xe0t\xc6\xd8@\xbb\xbf\xc8', @@ -100,6 +101,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '+N\xb0s\x19\xbf\xa0w\xa4\n/\x04\x916Y\xae\xf0\xdaB\xda', '\x9a8\x12)\x97\xb3\xac\x97\xbe*\x9a\xa2\xe5V\x83\x83A\xfd\xf2\xcc', @@ -112,6 +114,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '\x81\x9e%\x8d1\xa5\xe1`f)\xf3e\xbb\x90*\x1b!\xeeB\x16', '\xb1zk\xd3g=\x9a\xb8\xce\xd5\x81\xa2\t\xf6/=\xa5\xccEx', @@ -211,6 +214,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '\x99/Gy\x02\x9a=\xf8\xd0fm\x00\xbb\x92OicN', '\xa9\x88\xfbCX>\x87\x1d\x1e\xd5u\x0e\xe0t\xc6\xd8@\xbb\xbf\xc8' @@ -226,6 +230,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '+N\xb0s\x19\xbf\xa0w\xa4\n/\x04\x916Y\xae\xf0\xdaB\xda', '\x9a8\x12)\x97\xb3\xac\x97\xbe*\x9a\xa2\xe5V\x83\x83A\xfd\xf2\xcc' @@ -237,6 +242,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '\x81\x9e%\x8d1\xa5\xe1`f)\xf3e\xbb\x90*\x1b!\xeeB\x16' ], @@ -317,6 +323,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '\xec\x80NH\x8c \x88\xc25\t\x9a\x10 u\x13\xbe\xcd\xc3\xdd\xa5', '\x04\\\x7f9\'\xda\x13\xe7Z\xf8\xf0\xe4\xf0HI\xe4a\xa9x\x0f', @@ -333,6 +340,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '+N\xb0s\x19\xbf\xa0w\xa4\n/\x04\x916Y\xae\xf0\xdaB\xda', '\xc2\xa2\x05\xc8\xb2\xad\xe2J\xf2`b\xe5<\xd5\xbc8\x01\xd6`\xda' @@ -344,6 +352,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '\x81\x9e%\x8d1\xa5\xe1`f)\xf3e\xbb\x90*\x1b!\xeeB\x16', '\xb1zk\xd3g=\x9a\xb8\xce\xd5\x81\xa2\t\xf6/=\xa5\xccEx', @@ -498,6 +507,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '\x99/Gy\x02\x9a=\xf8\xd0fm\x00\xbb\x92OicN', '\xa9\x88\xfbCX>\x87\x1d\x1e\xd5u\x0e\xe0t\xc6\xd8@\xbb\xbf\xc8', @@ -516,6 +526,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '+N\xb0s\x19\xbf\xa0w\xa4\n/\x04\x916Y\xae\xf0\xdaB\xda', '\x9a8\x12)\x97\xb3\xac\x97\xbe*\x9a\xa2\xe5V\x83\x83A\xfd\xf2\xcc', @@ -528,6 +539,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '\x81\x9e%\x8d1\xa5\xe1`f)\xf3e\xbb\x90*\x1b!\xeeB\x16', '\xb1zk\xd3g=\x9a\xb8\xce\xd5\x81\xa2\t\xf6/=\xa5\xccEx', diff --git a/tests/test-wireproto-command-manifestdata.t b/tests/test-wireproto-command-manifestdata.t --- a/tests/test-wireproto-command-manifestdata.t +++ b/tests/test-wireproto-command-manifestdata.t @@ -248,6 +248,7 @@ ] Requesting revision data works +(haveparents defaults to false, so fulltext is emitted) $ sendhttpv2peer << EOF > command manifestdata @@ -278,6 +279,124 @@ s> \xa1FstatusBok s> \r\n received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) + s> 167\r\n + s> _\x01\x00\x01\x00\x02\x001 + s> \xa1Jtotalitems\x01\xa2DnodeTF\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0Lrevisionsize\x19\x01$Y\x01$a\x000879345e39377229634b420c639454156726c6b6\n + s> b\x00819e258d31a5e1606629f365bb902a1b21ee4216\n + s> dir0/c\x00914445346a0ca0629bd47ceb5dfe07e4d4cf2501\n + s> dir0/child0/e\x00bbba6c06b30f443d34ff841bc985c4d0827c6be4\n + s> dir0/child1/f\x0012fc7dcd773b5a0a929ce195228083c6ddc9cec4\n + s> dir0/d\x00538206dc971e521540d6843abfe6d16032f6d426\n + s> \r\n + received frame(size=351; request=1; stream=2; streamflags=; type=command-response; flags=continuation) + s> 8\r\n + s> \x00\x00\x00\x01\x00\x02\x002 + s> \r\n + s> 0\r\n
D4492: wireprotov2: let clients drive delta behavior
indygreg updated this revision to Diff 10971. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4492?vs=10805=10971 REVISION DETAIL https://phab.mercurial-scm.org/D4492 AFFECTED FILES mercurial/exchangev2.py mercurial/help/internals/wireprotocolv2.txt mercurial/wireprotov2server.py tests/test-http-protocol.t tests/test-wireproto-command-capabilities.t tests/test-wireproto-command-filedata.t tests/test-wireproto-command-manifestdata.t tests/test-wireproto-exchangev2.t CHANGE DETAILS diff --git a/tests/test-wireproto-exchangev2.t b/tests/test-wireproto-exchangev2.t --- a/tests/test-wireproto-exchangev2.t +++ b/tests/test-wireproto-exchangev2.t @@ -82,6 +82,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '\x99/Gy\x02\x9a=\xf8\xd0fm\x00\xbb\x92OicN', '\xa9\x88\xfbCX>\x87\x1d\x1e\xd5u\x0e\xe0t\xc6\xd8@\xbb\xbf\xc8', @@ -100,6 +101,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '+N\xb0s\x19\xbf\xa0w\xa4\n/\x04\x916Y\xae\xf0\xdaB\xda', '\x9a8\x12)\x97\xb3\xac\x97\xbe*\x9a\xa2\xe5V\x83\x83A\xfd\xf2\xcc', @@ -112,6 +114,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '\x81\x9e%\x8d1\xa5\xe1`f)\xf3e\xbb\x90*\x1b!\xeeB\x16', '\xb1zk\xd3g=\x9a\xb8\xce\xd5\x81\xa2\t\xf6/=\xa5\xccEx', @@ -211,6 +214,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '\x99/Gy\x02\x9a=\xf8\xd0fm\x00\xbb\x92OicN', '\xa9\x88\xfbCX>\x87\x1d\x1e\xd5u\x0e\xe0t\xc6\xd8@\xbb\xbf\xc8' @@ -226,6 +230,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '+N\xb0s\x19\xbf\xa0w\xa4\n/\x04\x916Y\xae\xf0\xdaB\xda', '\x9a8\x12)\x97\xb3\xac\x97\xbe*\x9a\xa2\xe5V\x83\x83A\xfd\xf2\xcc' @@ -237,6 +242,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '\x81\x9e%\x8d1\xa5\xe1`f)\xf3e\xbb\x90*\x1b!\xeeB\x16' ], @@ -317,6 +323,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '\xec\x80NH\x8c \x88\xc25\t\x9a\x10 u\x13\xbe\xcd\xc3\xdd\xa5', '\x04\\\x7f9\'\xda\x13\xe7Z\xf8\xf0\xe4\xf0HI\xe4a\xa9x\x0f', @@ -333,6 +340,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '+N\xb0s\x19\xbf\xa0w\xa4\n/\x04\x916Y\xae\xf0\xdaB\xda', '\xc2\xa2\x05\xc8\xb2\xad\xe2J\xf2`b\xe5<\xd5\xbc8\x01\xd6`\xda' @@ -344,6 +352,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '\x81\x9e%\x8d1\xa5\xe1`f)\xf3e\xbb\x90*\x1b!\xeeB\x16', '\xb1zk\xd3g=\x9a\xb8\xce\xd5\x81\xa2\t\xf6/=\xa5\xccEx', @@ -498,6 +507,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '\x99/Gy\x02\x9a=\xf8\xd0fm\x00\xbb\x92OicN', '\xa9\x88\xfbCX>\x87\x1d\x1e\xd5u\x0e\xe0t\xc6\xd8@\xbb\xbf\xc8', @@ -516,6 +526,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '+N\xb0s\x19\xbf\xa0w\xa4\n/\x04\x916Y\xae\xf0\xdaB\xda', '\x9a8\x12)\x97\xb3\xac\x97\xbe*\x9a\xa2\xe5V\x83\x83A\xfd\xf2\xcc', @@ -528,6 +539,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '\x81\x9e%\x8d1\xa5\xe1`f)\xf3e\xbb\x90*\x1b!\xeeB\x16', '\xb1zk\xd3g=\x9a\xb8\xce\xd5\x81\xa2\t\xf6/=\xa5\xccEx', diff --git a/tests/test-wireproto-command-manifestdata.t b/tests/test-wireproto-command-manifestdata.t --- a/tests/test-wireproto-command-manifestdata.t +++ b/tests/test-wireproto-command-manifestdata.t @@ -248,6 +248,7 @@ ] Requesting revision data works +(haveparents defaults to false, so fulltext is emitted) $ sendhttpv2peer << EOF > command manifestdata @@ -278,6 +279,124 @@ s> \xa1FstatusBok s> \r\n received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) + s> 167\r\n + s> _\x01\x00\x01\x00\x02\x001 + s> \xa1Jtotalitems\x01\xa2DnodeTF\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0Lrevisionsize\x19\x01$Y\x01$a\x000879345e39377229634b420c639454156726c6b6\n + s> b\x00819e258d31a5e1606629f365bb902a1b21ee4216\n + s> dir0/c\x00914445346a0ca0629bd47ceb5dfe07e4d4cf2501\n + s> dir0/child0/e\x00bbba6c06b30f443d34ff841bc985c4d0827c6be4\n + s> dir0/child1/f\x0012fc7dcd773b5a0a929ce195228083c6ddc9cec4\n + s> dir0/d\x00538206dc971e521540d6843abfe6d16032f6d426\n + s> \r\n + received frame(size=351; request=1; stream=2; streamflags=; type=command-response; flags=continuation) + s> 8\r\n + s> \x00\x00\x00\x01\x00\x02\x002 + s> \r\n + s> 0\r\n + s> \r\n + received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) + response: gen[ +{ +
D4492: wireprotov2: let clients drive delta behavior
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 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. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4492 AFFECTED FILES mercurial/exchangev2.py mercurial/help/internals/wireprotocolv2.txt mercurial/wireprotov2server.py tests/test-http-protocol.t tests/test-wireproto-command-capabilities.t tests/test-wireproto-command-filedata.t tests/test-wireproto-command-manifestdata.t tests/test-wireproto-exchangev2.t CHANGE DETAILS diff --git a/tests/test-wireproto-exchangev2.t b/tests/test-wireproto-exchangev2.t --- a/tests/test-wireproto-exchangev2.t +++ b/tests/test-wireproto-exchangev2.t @@ -82,6 +82,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '\x99/Gy\x02\x9a=\xf8\xd0fm\x00\xbb\x92OicN', '\xa9\x88\xfbCX>\x87\x1d\x1e\xd5u\x0e\xe0t\xc6\xd8@\xbb\xbf\xc8', @@ -100,6 +101,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '+N\xb0s\x19\xbf\xa0w\xa4\n/\x04\x916Y\xae\xf0\xdaB\xda', '\x9a8\x12)\x97\xb3\xac\x97\xbe*\x9a\xa2\xe5V\x83\x83A\xfd\xf2\xcc', @@ -112,6 +114,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '\x81\x9e%\x8d1\xa5\xe1`f)\xf3e\xbb\x90*\x1b!\xeeB\x16', '\xb1zk\xd3g=\x9a\xb8\xce\xd5\x81\xa2\t\xf6/=\xa5\xccEx', @@ -211,6 +214,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '\x99/Gy\x02\x9a=\xf8\xd0fm\x00\xbb\x92OicN', '\xa9\x88\xfbCX>\x87\x1d\x1e\xd5u\x0e\xe0t\xc6\xd8@\xbb\xbf\xc8' @@ -226,6 +230,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '+N\xb0s\x19\xbf\xa0w\xa4\n/\x04\x916Y\xae\xf0\xdaB\xda', '\x9a8\x12)\x97\xb3\xac\x97\xbe*\x9a\xa2\xe5V\x83\x83A\xfd\xf2\xcc' @@ -237,6 +242,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '\x81\x9e%\x8d1\xa5\xe1`f)\xf3e\xbb\x90*\x1b!\xeeB\x16' ], @@ -317,6 +323,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '\xec\x80NH\x8c \x88\xc25\t\x9a\x10 u\x13\xbe\xcd\xc3\xdd\xa5', '\x04\\\x7f9\'\xda\x13\xe7Z\xf8\xf0\xe4\xf0HI\xe4a\xa9x\x0f', @@ -333,6 +340,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '+N\xb0s\x19\xbf\xa0w\xa4\n/\x04\x916Y\xae\xf0\xdaB\xda', '\xc2\xa2\x05\xc8\xb2\xad\xe2J\xf2`b\xe5<\xd5\xbc8\x01\xd6`\xda' @@ -344,6 +352,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '\x81\x9e%\x8d1\xa5\xe1`f)\xf3e\xbb\x90*\x1b!\xeeB\x16', '\xb1zk\xd3g=\x9a\xb8\xce\xd5\x81\xa2\t\xf6/=\xa5\xccEx', @@ -498,6 +507,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '\x99/Gy\x02\x9a=\xf8\xd0fm\x00\xbb\x92OicN', '\xa9\x88\xfbCX>\x87\x1d\x1e\xd5u\x0e\xe0t\xc6\xd8@\xbb\xbf\xc8', @@ -516,6 +526,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '+N\xb0s\x19\xbf\xa0w\xa4\n/\x04\x916Y\xae\xf0\xdaB\xda', '\x9a8\x12)\x97\xb3\xac\x97\xbe*\x9a\xa2\xe5V\x83\x83A\xfd\xf2\xcc', @@ -528,6 +539,7 @@ 'parents', 'revision' ]), +'haveparents': True, 'nodes': [ '\x81\x9e%\x8d1\xa5\xe1`f)\xf3e\xbb\x90*\x1b!\xeeB\x16', '\xb1zk\xd3g=\x9a\xb8\xce\xd5\x81\xa2\t\xf6/=\xa5\xccEx', diff --git a/tests/test-wireproto-command-manifestdata.t b/tests/test-wireproto-command-manifestdata.t --- a/tests/test-wireproto-command-manifestdata.t +++ b/tests/test-wireproto-command-manifestdata.t @@ -248,6 +248,7 @@ ] Requesting revision data works +(haveparents defaults to false, so fulltext is emitted) $ sendhttpv2peer << EOF > command manifestdata @@ -278,6 +279,124 @@ s> \xa1FstatusBok s> \r\n received frame(size=11; request=1; stream=2; streamflags=stream-begin;