Show More
This diff has been collapsed as it changes many lines, (507 lines changed) Show them Hide them | |||
@@ -0,0 +1,507 b'' | |||
|
1 | $ . $TESTDIR/wireprotohelpers.sh | |
|
2 | ||
|
3 | $ hg init server | |
|
4 | $ enablehttpv2 server | |
|
5 | $ cd server | |
|
6 | $ echo a0 > a | |
|
7 | $ echo b0 > b | |
|
8 | $ mkdir -p dir0/child0 dir0/child1 dir1 | |
|
9 | $ echo c0 > dir0/c | |
|
10 | $ echo d0 > dir0/d | |
|
11 | $ echo e0 > dir0/child0/e | |
|
12 | $ echo f0 > dir0/child1/f | |
|
13 | $ hg -q commit -A -m 'commit 0' | |
|
14 | ||
|
15 | $ echo a1 > a | |
|
16 | $ echo d1 > dir0/d | |
|
17 | $ hg commit -m 'commit 1' | |
|
18 | $ echo f0 > dir0/child1/f | |
|
19 | $ hg commit -m 'commit 2' | |
|
20 | nothing changed | |
|
21 | [1] | |
|
22 | ||
|
23 | $ hg -q up -r 0 | |
|
24 | $ echo a2 > a | |
|
25 | $ hg commit -m 'commit 3' | |
|
26 | created new head | |
|
27 | ||
|
28 | $ hg log -G -T '{rev}:{node} {desc}\n' | |
|
29 | @ 2:c8757a2ffe552850d1e0dfe60d295ebf64c196d9 commit 3 | |
|
30 | | | |
|
31 | | o 1:650165e803375748a94df471e5b58d85763e0b29 commit 1 | |
|
32 | |/ | |
|
33 | o 0:6d85ca1270b377d320098556ba5bfad34a9ee12d commit 0 | |
|
34 | ||
|
35 | ||
|
36 | $ hg --debug debugindex -m | |
|
37 | rev linkrev nodeid p1 p2 | |
|
38 | 0 0 1b175b595f022cfab5b809cc0ed551bd0b3ff5e4 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 | |
|
39 | 1 1 91e0bdbfb0dde0023fa063edc1445f207a22eac7 1b175b595f022cfab5b809cc0ed551bd0b3ff5e4 0000000000000000000000000000000000000000 | |
|
40 | 2 2 46a6721b5edaf0ea04b79a5cb3218854a4d2aba0 1b175b595f022cfab5b809cc0ed551bd0b3ff5e4 0000000000000000000000000000000000000000 | |
|
41 | ||
|
42 | $ hg serve -p $HGPORT -d --pid-file hg.pid -E error.log | |
|
43 | $ cat hg.pid > $DAEMON_PIDS | |
|
44 | ||
|
45 | Missing arguments is an error | |
|
46 | ||
|
47 | $ sendhttpv2peer << EOF | |
|
48 | > command manifestdata | |
|
49 | > EOF | |
|
50 | creating http peer for wire protocol version 2 | |
|
51 | sending manifestdata command | |
|
52 | s> POST /api/exp-http-v2-0001/ro/manifestdata HTTP/1.1\r\n | |
|
53 | s> Accept-Encoding: identity\r\n | |
|
54 | s> accept: application/mercurial-exp-framing-0005\r\n | |
|
55 | s> content-type: application/mercurial-exp-framing-0005\r\n | |
|
56 | s> content-length: 27\r\n | |
|
57 | s> host: $LOCALIP:$HGPORT\r\n (glob) | |
|
58 | s> user-agent: Mercurial debugwireproto\r\n | |
|
59 | s> \r\n | |
|
60 | s> \x13\x00\x00\x01\x00\x01\x01\x11\xa1DnameLmanifestdata | |
|
61 | s> makefile('rb', None) | |
|
62 | s> HTTP/1.1 200 OK\r\n | |
|
63 | s> Server: testing stub value\r\n | |
|
64 | s> Date: $HTTP_DATE$\r\n | |
|
65 | s> Content-Type: application/mercurial-exp-framing-0005\r\n | |
|
66 | s> Transfer-Encoding: chunked\r\n | |
|
67 | s> \r\n | |
|
68 | s> 45\r\n | |
|
69 | s> =\x00\x00\x01\x00\x02\x012 | |
|
70 | s> \xa2Eerror\xa1GmessageX\x1enodes argument must be definedFstatusEerror | |
|
71 | s> \r\n | |
|
72 | received frame(size=61; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos) | |
|
73 | s> 0\r\n | |
|
74 | s> \r\n | |
|
75 | abort: nodes argument must be defined! | |
|
76 | [255] | |
|
77 | ||
|
78 | $ sendhttpv2peer << EOF | |
|
79 | > command manifestdata | |
|
80 | > nodes eval:[] | |
|
81 | > EOF | |
|
82 | creating http peer for wire protocol version 2 | |
|
83 | sending manifestdata command | |
|
84 | s> POST /api/exp-http-v2-0001/ro/manifestdata HTTP/1.1\r\n | |
|
85 | s> Accept-Encoding: identity\r\n | |
|
86 | s> accept: application/mercurial-exp-framing-0005\r\n | |
|
87 | s> content-type: application/mercurial-exp-framing-0005\r\n | |
|
88 | s> content-length: 40\r\n | |
|
89 | s> host: $LOCALIP:$HGPORT\r\n (glob) | |
|
90 | s> user-agent: Mercurial debugwireproto\r\n | |
|
91 | s> \r\n | |
|
92 | s> \x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa1Enodes\x80DnameLmanifestdata | |
|
93 | s> makefile('rb', None) | |
|
94 | s> HTTP/1.1 200 OK\r\n | |
|
95 | s> Server: testing stub value\r\n | |
|
96 | s> Date: $HTTP_DATE$\r\n | |
|
97 | s> Content-Type: application/mercurial-exp-framing-0005\r\n | |
|
98 | s> Transfer-Encoding: chunked\r\n | |
|
99 | s> \r\n | |
|
100 | s> 44\r\n | |
|
101 | s> <\x00\x00\x01\x00\x02\x012 | |
|
102 | s> \xa2Eerror\xa1GmessageX\x1dtree argument must be definedFstatusEerror | |
|
103 | s> \r\n | |
|
104 | received frame(size=60; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos) | |
|
105 | s> 0\r\n | |
|
106 | s> \r\n | |
|
107 | abort: tree argument must be defined! | |
|
108 | [255] | |
|
109 | ||
|
110 | Unknown node is an error | |
|
111 | ||
|
112 | $ sendhttpv2peer << EOF | |
|
113 | > command manifestdata | |
|
114 | > nodes eval:[b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'] | |
|
115 | > tree eval:b'' | |
|
116 | > EOF | |
|
117 | creating http peer for wire protocol version 2 | |
|
118 | sending manifestdata command | |
|
119 | s> POST /api/exp-http-v2-0001/ro/manifestdata HTTP/1.1\r\n | |
|
120 | s> Accept-Encoding: identity\r\n | |
|
121 | s> accept: application/mercurial-exp-framing-0005\r\n | |
|
122 | s> content-type: application/mercurial-exp-framing-0005\r\n | |
|
123 | s> content-length: 67\r\n | |
|
124 | s> host: $LOCALIP:$HGPORT\r\n (glob) | |
|
125 | s> user-agent: Mercurial debugwireproto\r\n | |
|
126 | s> \r\n | |
|
127 | s> ;\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa2Enodes\x81T\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaaDtree@DnameLmanifestdata | |
|
128 | s> makefile('rb', None) | |
|
129 | s> HTTP/1.1 200 OK\r\n | |
|
130 | s> Server: testing stub value\r\n | |
|
131 | s> Date: $HTTP_DATE$\r\n | |
|
132 | s> Content-Type: application/mercurial-exp-framing-0005\r\n | |
|
133 | s> Transfer-Encoding: chunked\r\n | |
|
134 | s> \r\n | |
|
135 | s> 51\r\n | |
|
136 | s> I\x00\x00\x01\x00\x02\x012 | |
|
137 | s> \xa2Eerror\xa2Dargs\x81T\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaaGmessagePunknown node: %sFstatusEerror | |
|
138 | s> \r\n | |
|
139 | received frame(size=73; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos) | |
|
140 | s> 0\r\n | |
|
141 | s> \r\n | |
|
142 | abort: unknown node: \xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa! (esc) | |
|
143 | [255] | |
|
144 | ||
|
145 | Fetching a single revision returns just metadata by default | |
|
146 | ||
|
147 | $ sendhttpv2peer << EOF | |
|
148 | > command manifestdata | |
|
149 | > nodes eval:[b'\x46\xa6\x72\x1b\x5e\xda\xf0\xea\x04\xb7\x9a\x5c\xb3\x21\x88\x54\xa4\xd2\xab\xa0'] | |
|
150 | > tree eval:b'' | |
|
151 | > EOF | |
|
152 | creating http peer for wire protocol version 2 | |
|
153 | sending manifestdata command | |
|
154 | s> POST /api/exp-http-v2-0001/ro/manifestdata HTTP/1.1\r\n | |
|
155 | s> Accept-Encoding: identity\r\n | |
|
156 | s> accept: application/mercurial-exp-framing-0005\r\n | |
|
157 | s> content-type: application/mercurial-exp-framing-0005\r\n | |
|
158 | s> content-length: 67\r\n | |
|
159 | s> host: $LOCALIP:$HGPORT\r\n (glob) | |
|
160 | s> user-agent: Mercurial debugwireproto\r\n | |
|
161 | s> \r\n | |
|
162 | s> ;\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa2Enodes\x81TF\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0Dtree@DnameLmanifestdata | |
|
163 | s> makefile('rb', None) | |
|
164 | s> HTTP/1.1 200 OK\r\n | |
|
165 | s> Server: testing stub value\r\n | |
|
166 | s> Date: $HTTP_DATE$\r\n | |
|
167 | s> Content-Type: application/mercurial-exp-framing-0005\r\n | |
|
168 | s> Transfer-Encoding: chunked\r\n | |
|
169 | s> \r\n | |
|
170 | s> 13\r\n | |
|
171 | s> \x0b\x00\x00\x01\x00\x02\x011 | |
|
172 | s> \xa1FstatusBok | |
|
173 | s> \r\n | |
|
174 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) | |
|
175 | s> 30\r\n | |
|
176 | s> (\x00\x00\x01\x00\x02\x001 | |
|
177 | s> \xa1Jtotalitems\x01\xa1DnodeTF\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0 | |
|
178 | s> \r\n | |
|
179 | received frame(size=40; request=1; stream=2; streamflags=; type=command-response; flags=continuation) | |
|
180 | s> 8\r\n | |
|
181 | s> \x00\x00\x00\x01\x00\x02\x002 | |
|
182 | s> \r\n | |
|
183 | s> 0\r\n | |
|
184 | s> \r\n | |
|
185 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) | |
|
186 | response: gen[ | |
|
187 | { | |
|
188 | b'totalitems': 1 | |
|
189 | }, | |
|
190 | { | |
|
191 | b'node': b'F\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0' | |
|
192 | } | |
|
193 | ] | |
|
194 | ||
|
195 | Requesting parents works | |
|
196 | ||
|
197 | $ sendhttpv2peer << EOF | |
|
198 | > command manifestdata | |
|
199 | > nodes eval:[b'\x46\xa6\x72\x1b\x5e\xda\xf0\xea\x04\xb7\x9a\x5c\xb3\x21\x88\x54\xa4\xd2\xab\xa0'] | |
|
200 | > tree eval:b'' | |
|
201 | > fields eval:[b'parents'] | |
|
202 | > EOF | |
|
203 | creating http peer for wire protocol version 2 | |
|
204 | sending manifestdata command | |
|
205 | s> POST /api/exp-http-v2-0001/ro/manifestdata HTTP/1.1\r\n | |
|
206 | s> Accept-Encoding: identity\r\n | |
|
207 | s> accept: application/mercurial-exp-framing-0005\r\n | |
|
208 | s> content-type: application/mercurial-exp-framing-0005\r\n | |
|
209 | s> content-length: 83\r\n | |
|
210 | s> host: $LOCALIP:$HGPORT\r\n (glob) | |
|
211 | s> user-agent: Mercurial debugwireproto\r\n | |
|
212 | s> \r\n | |
|
213 | s> K\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa3Ffields\x81GparentsEnodes\x81TF\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0Dtree@DnameLmanifestdata | |
|
214 | s> makefile('rb', None) | |
|
215 | s> HTTP/1.1 200 OK\r\n | |
|
216 | s> Server: testing stub value\r\n | |
|
217 | s> Date: $HTTP_DATE$\r\n | |
|
218 | s> Content-Type: application/mercurial-exp-framing-0005\r\n | |
|
219 | s> Transfer-Encoding: chunked\r\n | |
|
220 | s> \r\n | |
|
221 | s> 13\r\n | |
|
222 | s> \x0b\x00\x00\x01\x00\x02\x011 | |
|
223 | s> \xa1FstatusBok | |
|
224 | s> \r\n | |
|
225 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) | |
|
226 | s> 63\r\n | |
|
227 | s> [\x00\x00\x01\x00\x02\x001 | |
|
228 | s> \xa1Jtotalitems\x01\xa2DnodeTF\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0Gparents\x82T\x1b\x17[Y_\x02,\xfa\xb5\xb8\t\xcc\x0e\xd5Q\xbd\x0b?\xf5\xe4T\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 | |
|
229 | s> \r\n | |
|
230 | received frame(size=91; request=1; stream=2; streamflags=; type=command-response; flags=continuation) | |
|
231 | s> 8\r\n | |
|
232 | s> \x00\x00\x00\x01\x00\x02\x002 | |
|
233 | s> \r\n | |
|
234 | s> 0\r\n | |
|
235 | s> \r\n | |
|
236 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) | |
|
237 | response: gen[ | |
|
238 | { | |
|
239 | b'totalitems': 1 | |
|
240 | }, | |
|
241 | { | |
|
242 | b'node': b'F\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0', | |
|
243 | b'parents': [ | |
|
244 | b'\x1b\x17[Y_\x02,\xfa\xb5\xb8\t\xcc\x0e\xd5Q\xbd\x0b?\xf5\xe4', | |
|
245 | b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' | |
|
246 | ] | |
|
247 | } | |
|
248 | ] | |
|
249 | ||
|
250 | Requesting revision data works | |
|
251 | ||
|
252 | $ sendhttpv2peer << EOF | |
|
253 | > command manifestdata | |
|
254 | > nodes eval:[b'\x46\xa6\x72\x1b\x5e\xda\xf0\xea\x04\xb7\x9a\x5c\xb3\x21\x88\x54\xa4\xd2\xab\xa0'] | |
|
255 | > tree eval:b'' | |
|
256 | > fields eval:[b'revision'] | |
|
257 | > EOF | |
|
258 | creating http peer for wire protocol version 2 | |
|
259 | sending manifestdata command | |
|
260 | s> POST /api/exp-http-v2-0001/ro/manifestdata HTTP/1.1\r\n | |
|
261 | s> Accept-Encoding: identity\r\n | |
|
262 | s> accept: application/mercurial-exp-framing-0005\r\n | |
|
263 | s> content-type: application/mercurial-exp-framing-0005\r\n | |
|
264 | s> content-length: 84\r\n | |
|
265 | s> host: $LOCALIP:$HGPORT\r\n (glob) | |
|
266 | s> user-agent: Mercurial debugwireproto\r\n | |
|
267 | s> \r\n | |
|
268 | s> L\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa3Ffields\x81HrevisionEnodes\x81TF\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0Dtree@DnameLmanifestdata | |
|
269 | s> makefile('rb', None) | |
|
270 | s> HTTP/1.1 200 OK\r\n | |
|
271 | s> Server: testing stub value\r\n | |
|
272 | s> Date: $HTTP_DATE$\r\n | |
|
273 | s> Content-Type: application/mercurial-exp-framing-0005\r\n | |
|
274 | s> Transfer-Encoding: chunked\r\n | |
|
275 | s> \r\n | |
|
276 | s> 13\r\n | |
|
277 | s> \x0b\x00\x00\x01\x00\x02\x011 | |
|
278 | s> \xa1FstatusBok | |
|
279 | s> \r\n | |
|
280 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) | |
|
281 | s> 98\r\n | |
|
282 | s> \x90\x00\x00\x01\x00\x02\x001 | |
|
283 | s> \xa1Jtotalitems\x01\xa3MdeltabasenodeT\x1b\x17[Y_\x02,\xfa\xb5\xb8\t\xcc\x0e\xd5Q\xbd\x0b?\xf5\xe4Ideltasize\x187DnodeTF\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0X7\x00\x00\x00\x00\x00\x00\x00+\x00\x00\x00+a\x000879345e39377229634b420c639454156726c6b6\n | |
|
284 | s> \r\n | |
|
285 | received frame(size=144; request=1; stream=2; streamflags=; type=command-response; flags=continuation) | |
|
286 | s> 8\r\n | |
|
287 | s> \x00\x00\x00\x01\x00\x02\x002 | |
|
288 | s> \r\n | |
|
289 | s> 0\r\n | |
|
290 | s> \r\n | |
|
291 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) | |
|
292 | response: gen[ | |
|
293 | { | |
|
294 | b'totalitems': 1 | |
|
295 | }, | |
|
296 | { | |
|
297 | b'deltabasenode': b'\x1b\x17[Y_\x02,\xfa\xb5\xb8\t\xcc\x0e\xd5Q\xbd\x0b?\xf5\xe4', | |
|
298 | b'deltasize': 55, | |
|
299 | b'node': b'F\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0' | |
|
300 | }, | |
|
301 | b'\x00\x00\x00\x00\x00\x00\x00+\x00\x00\x00+a\x000879345e39377229634b420c639454156726c6b6\n' | |
|
302 | ] | |
|
303 | ||
|
304 | Requesting multiple revisions works | |
|
305 | ||
|
306 | $ sendhttpv2peer << EOF | |
|
307 | > command manifestdata | |
|
308 | > nodes eval:[b'\x1b\x17\x5b\x59\x5f\x02\x2c\xfa\xb5\xb8\x09\xcc\x0e\xd5\x51\xbd\x0b\x3f\xf5\xe4', b'\x46\xa6\x72\x1b\x5e\xda\xf0\xea\x04\xb7\x9a\x5c\xb3\x21\x88\x54\xa4\xd2\xab\xa0'] | |
|
309 | > tree eval:b'' | |
|
310 | > fields eval:[b'revision'] | |
|
311 | > EOF | |
|
312 | creating http peer for wire protocol version 2 | |
|
313 | sending manifestdata command | |
|
314 | s> POST /api/exp-http-v2-0001/ro/manifestdata HTTP/1.1\r\n | |
|
315 | s> Accept-Encoding: identity\r\n | |
|
316 | s> accept: application/mercurial-exp-framing-0005\r\n | |
|
317 | s> content-type: application/mercurial-exp-framing-0005\r\n | |
|
318 | s> content-length: 105\r\n | |
|
319 | s> host: $LOCALIP:$HGPORT\r\n (glob) | |
|
320 | s> user-agent: Mercurial debugwireproto\r\n | |
|
321 | s> \r\n | |
|
322 | s> a\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa3Ffields\x81HrevisionEnodes\x82T\x1b\x17[Y_\x02,\xfa\xb5\xb8\t\xcc\x0e\xd5Q\xbd\x0b?\xf5\xe4TF\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0Dtree@DnameLmanifestdata | |
|
323 | s> makefile('rb', None) | |
|
324 | s> HTTP/1.1 200 OK\r\n | |
|
325 | s> Server: testing stub value\r\n | |
|
326 | s> Date: $HTTP_DATE$\r\n | |
|
327 | s> Content-Type: application/mercurial-exp-framing-0005\r\n | |
|
328 | s> Transfer-Encoding: chunked\r\n | |
|
329 | s> \r\n | |
|
330 | s> 13\r\n | |
|
331 | s> \x0b\x00\x00\x01\x00\x02\x011 | |
|
332 | s> \xa1FstatusBok | |
|
333 | s> \r\n | |
|
334 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) | |
|
335 | s> 1ea\r\n | |
|
336 | s> \xe2\x01\x00\x01\x00\x02\x001 | |
|
337 | s> \xa1Jtotalitems\x02\xa2DnodeT\x1b\x17[Y_\x02,\xfa\xb5\xb8\t\xcc\x0e\xd5Q\xbd\x0b?\xf5\xe4Lrevisionsize\x19\x01$Y\x01$a\x002b4eb07319bfa077a40a2f04913659aef0da42da\n | |
|
338 | s> b\x00819e258d31a5e1606629f365bb902a1b21ee4216\n | |
|
339 | s> dir0/c\x00914445346a0ca0629bd47ceb5dfe07e4d4cf2501\n | |
|
340 | s> dir0/child0/e\x00bbba6c06b30f443d34ff841bc985c4d0827c6be4\n | |
|
341 | s> dir0/child1/f\x0012fc7dcd773b5a0a929ce195228083c6ddc9cec4\n | |
|
342 | s> dir0/d\x00538206dc971e521540d6843abfe6d16032f6d426\n | |
|
343 | s> \xa3MdeltabasenodeT\x1b\x17[Y_\x02,\xfa\xb5\xb8\t\xcc\x0e\xd5Q\xbd\x0b?\xf5\xe4Ideltasize\x187DnodeTF\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0X7\x00\x00\x00\x00\x00\x00\x00+\x00\x00\x00+a\x000879345e39377229634b420c639454156726c6b6\n | |
|
344 | s> \r\n | |
|
345 | received frame(size=482; request=1; stream=2; streamflags=; type=command-response; flags=continuation) | |
|
346 | s> 8\r\n | |
|
347 | s> \x00\x00\x00\x01\x00\x02\x002 | |
|
348 | s> \r\n | |
|
349 | s> 0\r\n | |
|
350 | s> \r\n | |
|
351 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) | |
|
352 | response: gen[ | |
|
353 | { | |
|
354 | b'totalitems': 2 | |
|
355 | }, | |
|
356 | { | |
|
357 | b'node': b'\x1b\x17[Y_\x02,\xfa\xb5\xb8\t\xcc\x0e\xd5Q\xbd\x0b?\xf5\xe4', | |
|
358 | b'revisionsize': 292 | |
|
359 | }, | |
|
360 | b'a\x002b4eb07319bfa077a40a2f04913659aef0da42da\nb\x00819e258d31a5e1606629f365bb902a1b21ee4216\ndir0/c\x00914445346a0ca0629bd47ceb5dfe07e4d4cf2501\ndir0/child0/e\x00bbba6c06b30f443d34ff841bc985c4d0827c6be4\ndir0/child1/f\x0012fc7dcd773b5a0a929ce195228083c6ddc9cec4\ndir0/d\x00538206dc971e521540d6843abfe6d16032f6d426\n', | |
|
361 | { | |
|
362 | b'deltabasenode': b'\x1b\x17[Y_\x02,\xfa\xb5\xb8\t\xcc\x0e\xd5Q\xbd\x0b?\xf5\xe4', | |
|
363 | b'deltasize': 55, | |
|
364 | b'node': b'F\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0' | |
|
365 | }, | |
|
366 | b'\x00\x00\x00\x00\x00\x00\x00+\x00\x00\x00+a\x000879345e39377229634b420c639454156726c6b6\n' | |
|
367 | ] | |
|
368 | ||
|
369 | Revisions are sorted by DAG order, parents first | |
|
370 | ||
|
371 | $ sendhttpv2peer << EOF | |
|
372 | > command manifestdata | |
|
373 | > nodes eval:[b'\x46\xa6\x72\x1b\x5e\xda\xf0\xea\x04\xb7\x9a\x5c\xb3\x21\x88\x54\xa4\xd2\xab\xa0', b'\x1b\x17\x5b\x59\x5f\x02\x2c\xfa\xb5\xb8\x09\xcc\x0e\xd5\x51\xbd\x0b\x3f\xf5\xe4'] | |
|
374 | > tree eval:b'' | |
|
375 | > fields eval:[b'revision'] | |
|
376 | > EOF | |
|
377 | creating http peer for wire protocol version 2 | |
|
378 | sending manifestdata command | |
|
379 | s> POST /api/exp-http-v2-0001/ro/manifestdata HTTP/1.1\r\n | |
|
380 | s> Accept-Encoding: identity\r\n | |
|
381 | s> accept: application/mercurial-exp-framing-0005\r\n | |
|
382 | s> content-type: application/mercurial-exp-framing-0005\r\n | |
|
383 | s> content-length: 105\r\n | |
|
384 | s> host: $LOCALIP:$HGPORT\r\n (glob) | |
|
385 | s> user-agent: Mercurial debugwireproto\r\n | |
|
386 | s> \r\n | |
|
387 | s> a\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa3Ffields\x81HrevisionEnodes\x82TF\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0T\x1b\x17[Y_\x02,\xfa\xb5\xb8\t\xcc\x0e\xd5Q\xbd\x0b?\xf5\xe4Dtree@DnameLmanifestdata | |
|
388 | s> makefile('rb', None) | |
|
389 | s> HTTP/1.1 200 OK\r\n | |
|
390 | s> Server: testing stub value\r\n | |
|
391 | s> Date: $HTTP_DATE$\r\n | |
|
392 | s> Content-Type: application/mercurial-exp-framing-0005\r\n | |
|
393 | s> Transfer-Encoding: chunked\r\n | |
|
394 | s> \r\n | |
|
395 | s> 13\r\n | |
|
396 | s> \x0b\x00\x00\x01\x00\x02\x011 | |
|
397 | s> \xa1FstatusBok | |
|
398 | s> \r\n | |
|
399 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) | |
|
400 | s> 1ea\r\n | |
|
401 | s> \xe2\x01\x00\x01\x00\x02\x001 | |
|
402 | s> \xa1Jtotalitems\x02\xa2DnodeT\x1b\x17[Y_\x02,\xfa\xb5\xb8\t\xcc\x0e\xd5Q\xbd\x0b?\xf5\xe4Lrevisionsize\x19\x01$Y\x01$a\x002b4eb07319bfa077a40a2f04913659aef0da42da\n | |
|
403 | s> b\x00819e258d31a5e1606629f365bb902a1b21ee4216\n | |
|
404 | s> dir0/c\x00914445346a0ca0629bd47ceb5dfe07e4d4cf2501\n | |
|
405 | s> dir0/child0/e\x00bbba6c06b30f443d34ff841bc985c4d0827c6be4\n | |
|
406 | s> dir0/child1/f\x0012fc7dcd773b5a0a929ce195228083c6ddc9cec4\n | |
|
407 | s> dir0/d\x00538206dc971e521540d6843abfe6d16032f6d426\n | |
|
408 | s> \xa3MdeltabasenodeT\x1b\x17[Y_\x02,\xfa\xb5\xb8\t\xcc\x0e\xd5Q\xbd\x0b?\xf5\xe4Ideltasize\x187DnodeTF\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0X7\x00\x00\x00\x00\x00\x00\x00+\x00\x00\x00+a\x000879345e39377229634b420c639454156726c6b6\n | |
|
409 | s> \r\n | |
|
410 | received frame(size=482; request=1; stream=2; streamflags=; type=command-response; flags=continuation) | |
|
411 | s> 8\r\n | |
|
412 | s> \x00\x00\x00\x01\x00\x02\x002 | |
|
413 | s> \r\n | |
|
414 | s> 0\r\n | |
|
415 | s> \r\n | |
|
416 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) | |
|
417 | response: gen[ | |
|
418 | { | |
|
419 | b'totalitems': 2 | |
|
420 | }, | |
|
421 | { | |
|
422 | b'node': b'\x1b\x17[Y_\x02,\xfa\xb5\xb8\t\xcc\x0e\xd5Q\xbd\x0b?\xf5\xe4', | |
|
423 | b'revisionsize': 292 | |
|
424 | }, | |
|
425 | b'a\x002b4eb07319bfa077a40a2f04913659aef0da42da\nb\x00819e258d31a5e1606629f365bb902a1b21ee4216\ndir0/c\x00914445346a0ca0629bd47ceb5dfe07e4d4cf2501\ndir0/child0/e\x00bbba6c06b30f443d34ff841bc985c4d0827c6be4\ndir0/child1/f\x0012fc7dcd773b5a0a929ce195228083c6ddc9cec4\ndir0/d\x00538206dc971e521540d6843abfe6d16032f6d426\n', | |
|
426 | { | |
|
427 | b'deltabasenode': b'\x1b\x17[Y_\x02,\xfa\xb5\xb8\t\xcc\x0e\xd5Q\xbd\x0b?\xf5\xe4', | |
|
428 | b'deltasize': 55, | |
|
429 | b'node': b'F\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0' | |
|
430 | }, | |
|
431 | b'\x00\x00\x00\x00\x00\x00\x00+\x00\x00\x00+a\x000879345e39377229634b420c639454156726c6b6\n' | |
|
432 | ] | |
|
433 | ||
|
434 | Requesting parents and revision data works | |
|
435 | ||
|
436 | $ sendhttpv2peer << EOF | |
|
437 | > command manifestdata | |
|
438 | > nodes eval:[b'\x1b\x17\x5b\x59\x5f\x02\x2c\xfa\xb5\xb8\x09\xcc\x0e\xd5\x51\xbd\x0b\x3f\xf5\xe4', b'\x46\xa6\x72\x1b\x5e\xda\xf0\xea\x04\xb7\x9a\x5c\xb3\x21\x88\x54\xa4\xd2\xab\xa0'] | |
|
439 | > tree eval:b'' | |
|
440 | > fields eval:[b'parents', b'revision'] | |
|
441 | > EOF | |
|
442 | creating http peer for wire protocol version 2 | |
|
443 | sending manifestdata command | |
|
444 | s> POST /api/exp-http-v2-0001/ro/manifestdata HTTP/1.1\r\n | |
|
445 | s> Accept-Encoding: identity\r\n | |
|
446 | s> accept: application/mercurial-exp-framing-0005\r\n | |
|
447 | s> content-type: application/mercurial-exp-framing-0005\r\n | |
|
448 | s> content-length: 113\r\n | |
|
449 | s> host: $LOCALIP:$HGPORT\r\n (glob) | |
|
450 | s> user-agent: Mercurial debugwireproto\r\n | |
|
451 | s> \r\n | |
|
452 | s> i\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa3Ffields\x82GparentsHrevisionEnodes\x82T\x1b\x17[Y_\x02,\xfa\xb5\xb8\t\xcc\x0e\xd5Q\xbd\x0b?\xf5\xe4TF\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0Dtree@DnameLmanifestdata | |
|
453 | s> makefile('rb', None) | |
|
454 | s> HTTP/1.1 200 OK\r\n | |
|
455 | s> Server: testing stub value\r\n | |
|
456 | s> Date: $HTTP_DATE$\r\n | |
|
457 | s> Content-Type: application/mercurial-exp-framing-0005\r\n | |
|
458 | s> Transfer-Encoding: chunked\r\n | |
|
459 | s> \r\n | |
|
460 | s> 13\r\n | |
|
461 | s> \x0b\x00\x00\x01\x00\x02\x011 | |
|
462 | s> \xa1FstatusBok | |
|
463 | s> \r\n | |
|
464 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) | |
|
465 | s> 250\r\n | |
|
466 | s> H\x02\x00\x01\x00\x02\x001 | |
|
467 | s> \xa1Jtotalitems\x02\xa3DnodeT\x1b\x17[Y_\x02,\xfa\xb5\xb8\t\xcc\x0e\xd5Q\xbd\x0b?\xf5\xe4Gparents\x82T\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00T\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00Lrevisionsize\x19\x01$Y\x01$a\x002b4eb07319bfa077a40a2f04913659aef0da42da\n | |
|
468 | s> b\x00819e258d31a5e1606629f365bb902a1b21ee4216\n | |
|
469 | s> dir0/c\x00914445346a0ca0629bd47ceb5dfe07e4d4cf2501\n | |
|
470 | s> dir0/child0/e\x00bbba6c06b30f443d34ff841bc985c4d0827c6be4\n | |
|
471 | s> dir0/child1/f\x0012fc7dcd773b5a0a929ce195228083c6ddc9cec4\n | |
|
472 | s> dir0/d\x00538206dc971e521540d6843abfe6d16032f6d426\n | |
|
473 | s> \xa4MdeltabasenodeT\x1b\x17[Y_\x02,\xfa\xb5\xb8\t\xcc\x0e\xd5Q\xbd\x0b?\xf5\xe4Ideltasize\x187DnodeTF\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0Gparents\x82T\x1b\x17[Y_\x02,\xfa\xb5\xb8\t\xcc\x0e\xd5Q\xbd\x0b?\xf5\xe4T\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00X7\x00\x00\x00\x00\x00\x00\x00+\x00\x00\x00+a\x000879345e39377229634b420c639454156726c6b6\n | |
|
474 | s> \r\n | |
|
475 | received frame(size=584; request=1; stream=2; streamflags=; type=command-response; flags=continuation) | |
|
476 | s> 8\r\n | |
|
477 | s> \x00\x00\x00\x01\x00\x02\x002 | |
|
478 | s> \r\n | |
|
479 | s> 0\r\n | |
|
480 | s> \r\n | |
|
481 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) | |
|
482 | response: gen[ | |
|
483 | { | |
|
484 | b'totalitems': 2 | |
|
485 | }, | |
|
486 | { | |
|
487 | b'node': b'\x1b\x17[Y_\x02,\xfa\xb5\xb8\t\xcc\x0e\xd5Q\xbd\x0b?\xf5\xe4', | |
|
488 | b'parents': [ | |
|
489 | b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', | |
|
490 | b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' | |
|
491 | ], | |
|
492 | b'revisionsize': 292 | |
|
493 | }, | |
|
494 | b'a\x002b4eb07319bfa077a40a2f04913659aef0da42da\nb\x00819e258d31a5e1606629f365bb902a1b21ee4216\ndir0/c\x00914445346a0ca0629bd47ceb5dfe07e4d4cf2501\ndir0/child0/e\x00bbba6c06b30f443d34ff841bc985c4d0827c6be4\ndir0/child1/f\x0012fc7dcd773b5a0a929ce195228083c6ddc9cec4\ndir0/d\x00538206dc971e521540d6843abfe6d16032f6d426\n', | |
|
495 | { | |
|
496 | b'deltabasenode': b'\x1b\x17[Y_\x02,\xfa\xb5\xb8\t\xcc\x0e\xd5Q\xbd\x0b?\xf5\xe4', | |
|
497 | b'deltasize': 55, | |
|
498 | b'node': b'F\xa6r\x1b^\xda\xf0\xea\x04\xb7\x9a\\\xb3!\x88T\xa4\xd2\xab\xa0', | |
|
499 | b'parents': [ | |
|
500 | b'\x1b\x17[Y_\x02,\xfa\xb5\xb8\t\xcc\x0e\xd5Q\xbd\x0b?\xf5\xe4', | |
|
501 | b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' | |
|
502 | ] | |
|
503 | }, | |
|
504 | b'\x00\x00\x00\x00\x00\x00\x00+\x00\x00\x00+a\x000879345e39377229634b420c639454156726c6b6\n' | |
|
505 | ] | |
|
506 | ||
|
507 | $ cat error.log |
@@ -258,6 +258,80 b' key' | |||
|
258 | 258 | |
|
259 | 259 | On success, returns a bytestring containing the resolved node. |
|
260 | 260 | |
|
261 | manifestdata | |
|
262 | ------------ | |
|
263 | ||
|
264 | Obtain various data related to manifests (which are lists of files in | |
|
265 | a revision). | |
|
266 | ||
|
267 | The command accepts the following arguments: | |
|
268 | ||
|
269 | fields | |
|
270 | (set of bytestring) Which data associated with manifests to fetch. | |
|
271 | The following values are recognized: | |
|
272 | ||
|
273 | parents | |
|
274 | Parent nodes for the manifest. | |
|
275 | ||
|
276 | revision | |
|
277 | The raw revision data for the manifest. | |
|
278 | ||
|
279 | nodes | |
|
280 | (array of bytestring) Manifest nodes whose data to retrieve. | |
|
281 | ||
|
282 | tree | |
|
283 | (bytestring) Path to manifest to retrieve. The empty bytestring represents | |
|
284 | the root manifest. All other values represent directories/trees within | |
|
285 | the repository. | |
|
286 | ||
|
287 | TODO allow specifying revisions via alternate means (such as from changeset | |
|
288 | revisions or ranges) | |
|
289 | TODO consider recursive expansion of manifests (with path filtering for | |
|
290 | narrow use cases) | |
|
291 | TODO more control over whether to emit fulltexts or deltas | |
|
292 | ||
|
293 | The response bytestream starts with a CBOR map describing the data that | |
|
294 | follows. It has the following bytestring keys: | |
|
295 | ||
|
296 | totalitems | |
|
297 | (unsigned integer) Total number of manifest revisions whose data is | |
|
298 | being returned. | |
|
299 | ||
|
300 | Following the header map is a series of 0 or more CBOR values. The first | |
|
301 | value is always a map describing a manifest revision. If this map has the | |
|
302 | ``deltasize`` or ``revisionsize`` keys, a bytestring containing the delta | |
|
303 | or revision, respectively, will immediately follow the map. Otherwise | |
|
304 | the next value will be a map describing the next manifest revision. | |
|
305 | ||
|
306 | Each map has the following bytestring keys: | |
|
307 | ||
|
308 | node | |
|
309 | (bytestring) The node of the manifest revision whose data is represented. | |
|
310 | ||
|
311 | deltabasenode | |
|
312 | (bytestring) The node that the delta representation of this revision is | |
|
313 | computed against. Only present if the ``revision`` field is requested and | |
|
314 | a delta is being emitted. | |
|
315 | ||
|
316 | deltasize | |
|
317 | (unsigned integer) The size of the delta data that follows this map. | |
|
318 | Only present if the ``revision`` field is requested and a delta is | |
|
319 | being emitted. | |
|
320 | ||
|
321 | parents | |
|
322 | (array of bytestring) The nodes of the parents of this manifest revision. | |
|
323 | Only present if the ``parents`` field is requested. | |
|
324 | ||
|
325 | revisionsize | |
|
326 | (unsigned integer) The size of the fulltext revision data that follows | |
|
327 | this map. Only present if the ``revision`` field is requested and a fulltext | |
|
328 | revision is being emitted. | |
|
329 | ||
|
330 | When ``revision`` data is requested, the server chooses to emit either fulltext | |
|
331 | revision data or a delta. What the server decides can be inferred by looking | |
|
332 | for the presence of the ``deltasize`` or ``revisionsize`` keys in the map. | |
|
333 | Servers MUST NOT define both keys. | |
|
334 | ||
|
261 | 335 | pushkey |
|
262 | 336 | ------- |
|
263 | 337 |
@@ -11,8 +11,11 b' import contextlib' | |||
|
11 | 11 | from .i18n import _ |
|
12 | 12 | from .node import ( |
|
13 | 13 | nullid, |
|
14 | nullrev, | |
|
14 | 15 | ) |
|
15 | 16 | from . import ( |
|
17 | changegroup, | |
|
18 | dagop, | |
|
16 | 19 | discovery, |
|
17 | 20 | encoding, |
|
18 | 21 | error, |
@@ -411,6 +414,67 b' def _capabilitiesv2(repo, proto):' | |||
|
411 | 414 | |
|
412 | 415 | return proto.addcapabilities(repo, caps) |
|
413 | 416 | |
|
417 | def builddeltarequests(store, nodes): | |
|
418 | """Build a series of revision delta requests against a backend store. | |
|
419 | ||
|
420 | Returns a list of revision numbers in the order they should be sent | |
|
421 | and a list of ``irevisiondeltarequest`` instances to be made against | |
|
422 | the backend store. | |
|
423 | """ | |
|
424 | # We sort and send nodes in DAG order because this is optimal for | |
|
425 | # storage emission. | |
|
426 | # TODO we may want a better storage API here - one where we can throw | |
|
427 | # a list of nodes and delta preconditions over a figurative wall and | |
|
428 | # have the storage backend figure it out for us. | |
|
429 | revs = dagop.linearize({store.rev(n) for n in nodes}, store.parentrevs) | |
|
430 | ||
|
431 | requests = [] | |
|
432 | ||
|
433 | for rev in revs: | |
|
434 | node = store.node(rev) | |
|
435 | parents = store.parents(node) | |
|
436 | deltaparent = store.node(store.deltaparent(rev)) | |
|
437 | ||
|
438 | # There is a delta in storage. That means we can send the delta | |
|
439 | # efficiently. | |
|
440 | # | |
|
441 | # But, the delta may be against a revision the receiver doesn't | |
|
442 | # have (e.g. shallow clone or when the delta isn't against a parent | |
|
443 | # revision). For now, we ignore the problem of shallow clone. As | |
|
444 | # long as a delta exists against a parent, we send it. | |
|
445 | # TODO allow arguments to control this behavior, as the receiver | |
|
446 | # may not have the base revision in some scenarios. | |
|
447 | if deltaparent != nullid and deltaparent in parents: | |
|
448 | basenode = deltaparent | |
|
449 | ||
|
450 | # Else there is no delta parent in storage or the delta that is | |
|
451 | # # there isn't suitable. Let's use a delta against a parent | |
|
452 | # revision, if possible. | |
|
453 | # | |
|
454 | # There is room to check if the delta parent is in the ancestry of | |
|
455 | # this node. But there isn't an API on the manifest storage object | |
|
456 | # for that. So ignore this case for now. | |
|
457 | ||
|
458 | elif parents[0] != nullid: | |
|
459 | basenode = parents[0] | |
|
460 | elif parents[1] != nullid: | |
|
461 | basenode = parents[1] | |
|
462 | ||
|
463 | # No potential bases to delta against. Send a full revision. | |
|
464 | else: | |
|
465 | basenode = nullid | |
|
466 | ||
|
467 | requests.append(changegroup.revisiondeltarequest( | |
|
468 | node=node, | |
|
469 | p1node=parents[0], | |
|
470 | p2node=parents[1], | |
|
471 | # Receiver deals with linknode resolution. | |
|
472 | linknode=nullid, | |
|
473 | basenode=basenode, | |
|
474 | )) | |
|
475 | ||
|
476 | return revs, requests | |
|
477 | ||
|
414 | 478 | def wireprotocommand(name, args=None, permission='push'): |
|
415 | 479 | """Decorator to declare a wire protocol command. |
|
416 | 480 | |
@@ -630,6 +694,87 b' def lookupv2(repo, proto, key):' | |||
|
630 | 694 | |
|
631 | 695 | yield node |
|
632 | 696 | |
|
697 | @wireprotocommand('manifestdata', | |
|
698 | args={ | |
|
699 | 'nodes': [b'0123456...'], | |
|
700 | 'fields': [b'parents', b'revision'], | |
|
701 | 'tree': b'', | |
|
702 | }, | |
|
703 | permission='pull') | |
|
704 | def manifestdata(repo, proto, nodes=None, fields=None, tree=None): | |
|
705 | fields = fields or set() | |
|
706 | ||
|
707 | if nodes is None: | |
|
708 | raise error.WireprotoCommandError( | |
|
709 | 'nodes argument must be defined') | |
|
710 | ||
|
711 | if tree is None: | |
|
712 | raise error.WireprotoCommandError( | |
|
713 | 'tree argument must be defined') | |
|
714 | ||
|
715 | store = repo.manifestlog.getstorage(tree) | |
|
716 | ||
|
717 | # Validate the node is known and abort on unknown revisions. | |
|
718 | for node in nodes: | |
|
719 | try: | |
|
720 | store.rev(node) | |
|
721 | except error.LookupError: | |
|
722 | raise error.WireprotoCommandError( | |
|
723 | 'unknown node: %s', (node,)) | |
|
724 | ||
|
725 | revs, requests = builddeltarequests(store, nodes) | |
|
726 | ||
|
727 | yield { | |
|
728 | b'totalitems': len(revs), | |
|
729 | } | |
|
730 | ||
|
731 | if b'revision' in fields: | |
|
732 | deltas = store.emitrevisiondeltas(requests) | |
|
733 | else: | |
|
734 | deltas = None | |
|
735 | ||
|
736 | for rev in revs: | |
|
737 | node = store.node(rev) | |
|
738 | ||
|
739 | if deltas is not None: | |
|
740 | delta = next(deltas) | |
|
741 | else: | |
|
742 | delta = None | |
|
743 | ||
|
744 | d = { | |
|
745 | b'node': node, | |
|
746 | } | |
|
747 | ||
|
748 | if b'parents' in fields: | |
|
749 | d[b'parents'] = store.parents(node) | |
|
750 | ||
|
751 | if b'revision' in fields: | |
|
752 | assert delta is not None | |
|
753 | assert delta.flags == 0 | |
|
754 | assert d[b'node'] == delta.node | |
|
755 | ||
|
756 | if delta.revision is not None: | |
|
757 | revisiondata = delta.revision | |
|
758 | d[b'revisionsize'] = len(revisiondata) | |
|
759 | else: | |
|
760 | d[b'deltabasenode'] = delta.basenode | |
|
761 | revisiondata = delta.delta | |
|
762 | d[b'deltasize'] = len(revisiondata) | |
|
763 | else: | |
|
764 | revisiondata = None | |
|
765 | ||
|
766 | yield d | |
|
767 | ||
|
768 | if revisiondata is not None: | |
|
769 | yield revisiondata | |
|
770 | ||
|
771 | if deltas is not None: | |
|
772 | try: | |
|
773 | next(deltas) | |
|
774 | raise error.ProgrammingError('should not have more deltas') | |
|
775 | except GeneratorExit: | |
|
776 | pass | |
|
777 | ||
|
633 | 778 | @wireprotocommand('pushkey', |
|
634 | 779 | args={ |
|
635 | 780 | 'namespace': b'ns', |
@@ -313,7 +313,7 b' Client with HTTPv2 enabled automatically' | |||
|
313 | 313 | s> Content-Type: application/mercurial-cbor\r\n |
|
314 | 314 | s> Content-Length: *\r\n (glob) |
|
315 | 315 | s> \r\n |
|
316 |
s> \xa3GapibaseDapi/Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa |
|
|
316 | s> \xa3GapibaseDapi/Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa9Ibranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullMchangesetdata\xa2Dargs\xa3Ffields\xd9\x01\x02\x82GparentsHrevisionInoderange\x82\x81J0123456...\x81Iabcdef...Enodes\x81J0123456...Kpermissions\x81DpullEheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullLmanifestdata\xa2Dargs\xa3Ffields\x82GparentsHrevisionEnodes\x81J0123456...Dtree@Kpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyInamespaceBnsCnewCnewColdColdKpermissions\x81DpushKcompression\x81\xa1DnameDzlibQframingmediatypes\x81X&application/mercurial-exp-framing-0005Nrawrepoformats\x82LgeneraldeltaHrevlogv1Nv1capabilitiesY\x01\xc5batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
|
317 | 317 | sending heads command |
|
318 | 318 | s> POST /api/exp-http-v2-0001/ro/heads HTTP/1.1\r\n |
|
319 | 319 | s> Accept-Encoding: identity\r\n |
@@ -212,7 +212,7 b' Request for HTTPv2 service returns infor' | |||
|
212 | 212 | s> Content-Type: application/mercurial-cbor\r\n |
|
213 | 213 | s> Content-Length: *\r\n (glob) |
|
214 | 214 | s> \r\n |
|
215 |
s> \xa3GapibaseDapi/Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa |
|
|
215 | s> \xa3GapibaseDapi/Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa9Ibranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullMchangesetdata\xa2Dargs\xa3Ffields\xd9\x01\x02\x82GparentsHrevisionInoderange\x82\x81J0123456...\x81Iabcdef...Enodes\x81J0123456...Kpermissions\x81DpullEheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullLmanifestdata\xa2Dargs\xa3Ffields\x82GparentsHrevisionEnodes\x81J0123456...Dtree@Kpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyInamespaceBnsCnewCnewColdColdKpermissions\x81DpushKcompression\x81\xa1DnameDzlibQframingmediatypes\x81X&application/mercurial-exp-framing-0005Nrawrepoformats\x82LgeneraldeltaHrevlogv1Nv1capabilitiesY\x01\xc5batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
|
216 | 216 | cbor> { |
|
217 | 217 | b'apibase': b'api/', |
|
218 | 218 | b'apis': { |
@@ -286,6 +286,21 b' Request for HTTPv2 service returns infor' | |||
|
286 | 286 | b'pull' |
|
287 | 287 | ] |
|
288 | 288 | }, |
|
289 | b'manifestdata': { | |
|
290 | b'args': { | |
|
291 | b'fields': [ | |
|
292 | b'parents', | |
|
293 | b'revision' | |
|
294 | ], | |
|
295 | b'nodes': [ | |
|
296 | b'0123456...' | |
|
297 | ], | |
|
298 | b'tree': b'' | |
|
299 | }, | |
|
300 | b'permissions': [ | |
|
301 | b'pull' | |
|
302 | ] | |
|
303 | }, | |
|
289 | 304 | b'pushkey': { |
|
290 | 305 | b'args': { |
|
291 | 306 | b'key': b'key', |
@@ -337,7 +352,7 b' capabilities command returns expected in' | |||
|
337 | 352 | s> Content-Type: application/mercurial-cbor\r\n |
|
338 | 353 | s> Content-Length: *\r\n (glob) |
|
339 | 354 | s> \r\n |
|
340 |
s> \xa3GapibaseDapi/Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa |
|
|
355 | s> \xa3GapibaseDapi/Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa9Ibranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullMchangesetdata\xa2Dargs\xa3Ffields\xd9\x01\x02\x82GparentsHrevisionInoderange\x82\x81J0123456...\x81Iabcdef...Enodes\x81J0123456...Kpermissions\x81DpullEheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullLmanifestdata\xa2Dargs\xa3Ffields\x82GparentsHrevisionEnodes\x81J0123456...Dtree@Kpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyInamespaceBnsCnewCnewColdColdKpermissions\x81DpushKcompression\x81\xa1DnameDzlibQframingmediatypes\x81X&application/mercurial-exp-framing-0005Nrawrepoformats\x82LgeneraldeltaHrevlogv1Nv1capabilitiesY\x01\xc5batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
|
341 | 356 | sending capabilities command |
|
342 | 357 | s> POST /api/exp-http-v2-0001/ro/capabilities HTTP/1.1\r\n |
|
343 | 358 | s> Accept-Encoding: identity\r\n |
@@ -360,11 +375,11 b' capabilities command returns expected in' | |||
|
360 | 375 | s> \xa1FstatusBok |
|
361 | 376 | s> \r\n |
|
362 | 377 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) |
|
363 |
s> 2 |
|
|
364 |
s> |
|
|
365 |
s> \xa4Hcommands\xa |
|
|
378 | s> 29a\r\n | |
|
379 | s> \x92\x02\x00\x01\x00\x02\x001 | |
|
380 | s> \xa4Hcommands\xa9Ibranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullMchangesetdata\xa2Dargs\xa3Ffields\xd9\x01\x02\x82GparentsHrevisionInoderange\x82\x81J0123456...\x81Iabcdef...Enodes\x81J0123456...Kpermissions\x81DpullEheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullLmanifestdata\xa2Dargs\xa3Ffields\x82GparentsHrevisionEnodes\x81J0123456...Dtree@Kpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyInamespaceBnsCnewCnewColdColdKpermissions\x81DpushKcompression\x81\xa1DnameDzlibQframingmediatypes\x81X&application/mercurial-exp-framing-0005Nrawrepoformats\x82LgeneraldeltaHrevlogv1 | |
|
366 | 381 | s> \r\n |
|
367 |
received frame(size= |
|
|
382 | received frame(size=658; request=1; stream=2; streamflags=; type=command-response; flags=continuation) | |
|
368 | 383 | s> 8\r\n |
|
369 | 384 | s> \x00\x00\x00\x01\x00\x02\x002 |
|
370 | 385 | s> \r\n |
@@ -442,6 +457,21 b' capabilities command returns expected in' | |||
|
442 | 457 | b'pull' |
|
443 | 458 | ] |
|
444 | 459 | }, |
|
460 | b'manifestdata': { | |
|
461 | b'args': { | |
|
462 | b'fields': [ | |
|
463 | b'parents', | |
|
464 | b'revision' | |
|
465 | ], | |
|
466 | b'nodes': [ | |
|
467 | b'0123456...' | |
|
468 | ], | |
|
469 | b'tree': b'' | |
|
470 | }, | |
|
471 | b'permissions': [ | |
|
472 | b'pull' | |
|
473 | ] | |
|
474 | }, | |
|
445 | 475 | b'pushkey': { |
|
446 | 476 | b'args': { |
|
447 | 477 | b'key': b'key', |
General Comments 0
You need to be logged in to leave comments.
Login now