wireprotov2: allow multiple fields to follow revision maps
The *data wire protocol commands emit a series of CBOR values. Because revision/delta data may be large, their data is emitted outside the map as a top-level bytestring value. Before this commit, we'd emit a single optional bytestring value after the revision descriptor map. This got the job done. But it was limiting in that we could only send a single field. And, it required the consumer to know that the presence of a key in the map implied the existence of a following bytestring value. This commit changes the encoding strategy so top-level bytestring values in the stream are explicitly denoted in a "fieldsfollowing" key. This key contains an array defining what fields that follow and the expected size of each field. By defining things this way, we can easily send N bytestring values without any ambiguity about their order. In addition, clients only need to know how to parse ``fieldsfollowing`` to know if extra values are present. Because this breaks backwards compatibility, we've bumped the version number of the wire protocol version 2 API endpoint. Differential Revision: https://phab.mercurial-scm.org/D4620
Showing
- mercurial/exchangev2.py 25 additions, 10 deletionsmercurial/exchangev2.py
- mercurial/help/internals/wireprotocolv2.txt 85 additions, 48 deletionsmercurial/help/internals/wireprotocolv2.txt
- mercurial/wireprototypes.py 2 additions, 2 deletionsmercurial/wireprototypes.py
- mercurial/wireprotov2server.py 33 additions, 20 deletionsmercurial/wireprotov2server.py
- tests/test-clone.t 5 additions, 5 deletionstests/test-clone.t
- tests/test-http-api-httpv2.t 20 additions, 20 deletionstests/test-http-api-httpv2.t
- tests/test-http-api.t 5 additions, 5 deletionstests/test-http-api.t
- tests/test-http-protocol.t 4 additions, 4 deletionstests/test-http-protocol.t
- tests/test-ssh-bundle1.t 2 additions, 2 deletionstests/test-ssh-bundle1.t
- tests/test-ssh-proto-unbundle.t 30 additions, 30 deletionstests/test-ssh-proto-unbundle.t
- tests/test-ssh-proto.t 42 additions, 42 deletionstests/test-ssh-proto.t
- tests/test-ssh.t 2 additions, 2 deletionstests/test-ssh.t
- tests/test-wireproto-command-branchmap.t 1 addition, 1 deletiontests/test-wireproto-command-branchmap.t
- tests/test-wireproto-command-capabilities.t 7 additions, 7 deletionstests/test-wireproto-command-capabilities.t
- tests/test-wireproto-command-changesetdata.t 82 additions, 47 deletionstests/test-wireproto-command-changesetdata.t
- tests/test-wireproto-command-filedata.t 82 additions, 42 deletionstests/test-wireproto-command-filedata.t
- tests/test-wireproto-command-heads.t 2 additions, 2 deletionstests/test-wireproto-command-heads.t
- tests/test-wireproto-command-known.t 3 additions, 3 deletionstests/test-wireproto-command-known.t
- tests/test-wireproto-command-listkeys.t 3 additions, 3 deletionstests/test-wireproto-command-listkeys.t
- tests/test-wireproto-command-manifestdata.t 116 additions, 61 deletionstests/test-wireproto-command-manifestdata.t
Loading
Please register or sign in to comment