comparison tests/test-wireproto-command-branchmap.t @ 37725:3ea8323d6f95

wireprotov2: change command response protocol to include a leading map The error handling mechanism for the new wire protocol isn't very well-defined. This commit takes us a step in the right direction by introducing a leading CBOR map for command responses. This map will contain an overall result of the command. Currently, the map indicates whether the command was overall successful or if an error occurred. And if an error occurred, that error is present in the map. There is still a dedicated error frame. My intent is to use that for protocol-level errors and for errors that are encountered after the initial response frame has been sent. This will be clarified in a later commit. Differential Revision: https://phab.mercurial-scm.org/D3385
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 14 Apr 2018 15:19:36 -0700
parents deff7cf7eefd
children 0f549da54379
comparison
equal deleted inserted replaced
37724:deff7cf7eefd 37725:3ea8323d6f95
43 > EOF 43 > EOF
44 creating http peer for wire protocol version 2 44 creating http peer for wire protocol version 2
45 sending branchmap command 45 sending branchmap command
46 s> POST /api/exp-http-v2-0001/ro/branchmap HTTP/1.1\r\n 46 s> POST /api/exp-http-v2-0001/ro/branchmap HTTP/1.1\r\n
47 s> Accept-Encoding: identity\r\n 47 s> Accept-Encoding: identity\r\n
48 s> accept: application/mercurial-exp-framing-0004\r\n 48 s> accept: application/mercurial-exp-framing-0005\r\n
49 s> content-type: application/mercurial-exp-framing-0004\r\n 49 s> content-type: application/mercurial-exp-framing-0005\r\n
50 s> content-length: 24\r\n 50 s> content-length: 24\r\n
51 s> host: $LOCALIP:$HGPORT\r\n (glob) 51 s> host: $LOCALIP:$HGPORT\r\n (glob)
52 s> user-agent: Mercurial debugwireproto\r\n 52 s> user-agent: Mercurial debugwireproto\r\n
53 s> \r\n 53 s> \r\n
54 s> \x10\x00\x00\x01\x00\x01\x01\x11\xa1DnameIbranchmap 54 s> \x10\x00\x00\x01\x00\x01\x01\x11\xa1DnameIbranchmap
55 s> makefile('rb', None) 55 s> makefile('rb', None)
56 s> HTTP/1.1 200 OK\r\n 56 s> HTTP/1.1 200 OK\r\n
57 s> Server: testing stub value\r\n 57 s> Server: testing stub value\r\n
58 s> Date: $HTTP_DATE$\r\n 58 s> Date: $HTTP_DATE$\r\n
59 s> Content-Type: application/mercurial-exp-framing-0004\r\n 59 s> Content-Type: application/mercurial-exp-framing-0005\r\n
60 s> Transfer-Encoding: chunked\r\n 60 s> Transfer-Encoding: chunked\r\n
61 s> \r\n 61 s> \r\n
62 s> 78\r\n 62 s> 83\r\n
63 s> p\x00\x00\x01\x00\x02\x012 63 s> {\x00\x00\x01\x00\x02\x012
64 s> \xa3Gbranch1\x81T\xb5\xfa\xac\xdf\xd2c7h\xcb1R3l\xc0\x953\x81&f\x88Gbranch2\x81T"Aa\xc7X\x9a\xa4\x8f\xa8:H\xfe\xff^\x95\xb5j\xe3\'\xfcGdefault\x82T&\x80Z\xba\x1e`\n 64 s> \xa1FstatusBok\xa3Gbranch1\x81T\xb5\xfa\xac\xdf\xd2c7h\xcb1R3l\xc0\x953\x81&f\x88Gbranch2\x81T"Aa\xc7X\x9a\xa4\x8f\xa8:H\xfe\xff^\x95\xb5j\xe3\'\xfcGdefault\x82T&\x80Z\xba\x1e`\n
65 s> \x82\xe96a\x14\x9f#\x13\x86j"\x1a{T\xbe\x0e\xf7<\x17\xad\xe3\xfc\x89\xdcAp\x1e\xb9\xfc:\x91\xb5\x82\x82 65 s> \x82\xe96a\x14\x9f#\x13\x86j"\x1a{T\xbe\x0e\xf7<\x17\xad\xe3\xfc\x89\xdcAp\x1e\xb9\xfc:\x91\xb5\x82\x82
66 s> \r\n 66 s> \r\n
67 received frame(size=112; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos) 67 received frame(size=123; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
68 s> 0\r\n 68 s> 0\r\n
69 s> \r\n 69 s> \r\n
70 response: {b'branch1': [b'\xb5\xfa\xac\xdf\xd2c7h\xcb1R3l\xc0\x953\x81&f\x88'], b'branch2': [b'"Aa\xc7X\x9a\xa4\x8f\xa8:H\xfe\xff^\x95\xb5j\xe3\'\xfc'], b'default': [b'&\x80Z\xba\x1e`\n\x82\xe96a\x14\x9f#\x13\x86j"\x1a{', b'\xbe\x0e\xf7<\x17\xad\xe3\xfc\x89\xdcAp\x1e\xb9\xfc:\x91\xb5\x82\x82']} 70 response: {b'branch1': [b'\xb5\xfa\xac\xdf\xd2c7h\xcb1R3l\xc0\x953\x81&f\x88'], b'branch2': [b'"Aa\xc7X\x9a\xa4\x8f\xa8:H\xfe\xff^\x95\xb5j\xe3\'\xfc'], b'default': [b'&\x80Z\xba\x1e`\n\x82\xe96a\x14\x9f#\x13\x86j"\x1a{', b'\xbe\x0e\xf7<\x17\xad\xe3\xfc\x89\xdcAp\x1e\xb9\xfc:\x91\xb5\x82\x82']}
71 71
72 $ cat error.log 72 $ cat error.log