Mercurial > hg
comparison tests/test-wireproto-command-changesetdata.t @ 39815:d3d333ab167a
wireprotov2: teach changesetdata to fetch ancestors until depth
For shallow clone, it is useful to specify a starting node and tell
the server to send up to N ancestors from that starting point. This
enables the server to perform the DAG walk without the client having
to discover the base/stop node(s) first.
This commit implements support for said queries on the changesetdata
command.
Differential Revision: https://phab.mercurial-scm.org/D4621
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 17 Sep 2018 11:50:59 -0700 |
parents | d059cb669632 |
children | 393e44324037 |
comparison
equal
deleted
inserted
replaced
39814:d059cb669632 | 39815:d3d333ab167a |
---|---|
102 s> 0\r\n | 102 s> 0\r\n |
103 s> \r\n | 103 s> \r\n |
104 abort: heads in noderange request cannot be empty! | 104 abort: heads in noderange request cannot be empty! |
105 [255] | 105 [255] |
106 | 106 |
107 nodesdepth requires nodes argument | |
108 | |
109 $ sendhttpv2peer << EOF | |
110 > command changesetdata | |
111 > nodesdepth 42 | |
112 > noderange eval:[[], [b'ignored']] | |
113 > EOF | |
114 creating http peer for wire protocol version 2 | |
115 sending changesetdata command | |
116 s> POST /api/exp-http-v2-0002/ro/changesetdata HTTP/1.1\r\n | |
117 s> Accept-Encoding: identity\r\n | |
118 s> accept: application/mercurial-exp-framing-0005\r\n | |
119 s> content-type: application/mercurial-exp-framing-0005\r\n | |
120 s> content-length: 69\r\n | |
121 s> host: $LOCALIP:$HGPORT\r\n (glob) | |
122 s> user-agent: Mercurial debugwireproto\r\n | |
123 s> \r\n | |
124 s> =\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa2Inoderange\x82\x80\x81GignoredJnodesdepthB42DnameMchangesetdata | |
125 s> makefile('rb', None) | |
126 s> HTTP/1.1 200 OK\r\n | |
127 s> Server: testing stub value\r\n | |
128 s> Date: $HTTP_DATE$\r\n | |
129 s> Content-Type: application/mercurial-exp-framing-0005\r\n | |
130 s> Transfer-Encoding: chunked\r\n | |
131 s> \r\n | |
132 s> 4d\r\n | |
133 s> E\x00\x00\x01\x00\x02\x012 | |
134 s> \xa2Eerror\xa1GmessageX&nodesdepth requires the nodes argumentFstatusEerror | |
135 s> \r\n | |
136 received frame(size=69; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos) | |
137 s> 0\r\n | |
138 s> \r\n | |
139 abort: nodesdepth requires the nodes argument! | |
140 [255] | |
141 | |
107 Sending just noderange heads sends all revisions | 142 Sending just noderange heads sends all revisions |
108 | 143 |
109 $ sendhttpv2peer << EOF | 144 $ sendhttpv2peer << EOF |
110 > command changesetdata | 145 > command changesetdata |
111 > noderange eval:[[], [b'\x0b\xb8\xad\x89\x4a\x15\xb1\x53\x80\xb2\xa2\xa5\xb1\x83\xe2\x0f\x2a\x4b\x28\xdd', b'\xea\xe5\xf8\x2c\x2e\x62\x23\x68\xd2\x7d\xae\xcb\x76\xb7\xe3\x93\xd0\xf2\x42\x11']] | 146 > noderange eval:[[], [b'\x0b\xb8\xad\x89\x4a\x15\xb1\x53\x80\xb2\xa2\xa5\xb1\x83\xe2\x0f\x2a\x4b\x28\xdd', b'\xea\xe5\xf8\x2c\x2e\x62\x23\x68\xd2\x7d\xae\xcb\x76\xb7\xe3\x93\xd0\xf2\x42\x11']] |
311 { | 346 { |
312 b'node': b'\xea\xe5\xf8,.b#h\xd2}\xae\xcbv\xb7\xe3\x93\xd0\xf2B\x11' | 347 b'node': b'\xea\xe5\xf8,.b#h\xd2}\xae\xcbv\xb7\xe3\x93\xd0\xf2B\x11' |
313 }, | 348 }, |
314 { | 349 { |
315 b'node': b'\x0b\xb8\xad\x89J\x15\xb1S\x80\xb2\xa2\xa5\xb1\x83\xe2\x0f*K(\xdd' | 350 b'node': b'\x0b\xb8\xad\x89J\x15\xb1S\x80\xb2\xa2\xa5\xb1\x83\xe2\x0f*K(\xdd' |
351 } | |
352 ] | |
353 | |
354 nodesdepth of 1 limits to exactly requested nodes | |
355 | |
356 $ sendhttpv2peer << EOF | |
357 > command changesetdata | |
358 > nodes eval:[b'\xea\xe5\xf8\x2c\x2e\x62\x23\x68\xd2\x7d\xae\xcb\x76\xb7\xe3\x93\xd0\xf2\x42\x11'] | |
359 > nodesdepth eval:1 | |
360 > EOF | |
361 creating http peer for wire protocol version 2 | |
362 sending changesetdata command | |
363 s> POST /api/exp-http-v2-0002/ro/changesetdata HTTP/1.1\r\n | |
364 s> Accept-Encoding: identity\r\n | |
365 s> accept: application/mercurial-exp-framing-0005\r\n | |
366 s> content-type: application/mercurial-exp-framing-0005\r\n | |
367 s> content-length: 74\r\n | |
368 s> host: $LOCALIP:$HGPORT\r\n (glob) | |
369 s> user-agent: Mercurial debugwireproto\r\n | |
370 s> \r\n | |
371 s> B\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa2Enodes\x81T\xea\xe5\xf8,.b#h\xd2}\xae\xcbv\xb7\xe3\x93\xd0\xf2B\x11Jnodesdepth\x01DnameMchangesetdata | |
372 s> makefile('rb', None) | |
373 s> HTTP/1.1 200 OK\r\n | |
374 s> Server: testing stub value\r\n | |
375 s> Date: $HTTP_DATE$\r\n | |
376 s> Content-Type: application/mercurial-exp-framing-0005\r\n | |
377 s> Transfer-Encoding: chunked\r\n | |
378 s> \r\n | |
379 s> 13\r\n | |
380 s> \x0b\x00\x00\x01\x00\x02\x011 | |
381 s> \xa1FstatusBok | |
382 s> \r\n | |
383 received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) | |
384 s> 30\r\n | |
385 s> (\x00\x00\x01\x00\x02\x001 | |
386 s> \xa1Jtotalitems\x01\xa1DnodeT\xea\xe5\xf8,.b#h\xd2}\xae\xcbv\xb7\xe3\x93\xd0\xf2B\x11 | |
387 s> \r\n | |
388 received frame(size=40; request=1; stream=2; streamflags=; type=command-response; flags=continuation) | |
389 s> 8\r\n | |
390 s> \x00\x00\x00\x01\x00\x02\x002 | |
391 s> \r\n | |
392 s> 0\r\n | |
393 s> \r\n | |
394 received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) | |
395 response: gen[ | |
396 { | |
397 b'totalitems': 1 | |
398 }, | |
399 { | |
400 b'node': b'\xea\xe5\xf8,.b#h\xd2}\xae\xcbv\xb7\xe3\x93\xd0\xf2B\x11' | |
401 } | |
402 ] | |
403 | |
404 nodesdepth of 2 limits to first ancestor | |
405 | |
406 $ sendhttpv2peer << EOF | |
407 > command changesetdata | |
408 > nodes eval:[b'\xea\xe5\xf8\x2c\x2e\x62\x23\x68\xd2\x7d\xae\xcb\x76\xb7\xe3\x93\xd0\xf2\x42\x11'] | |
409 > nodesdepth eval:2 | |
410 > EOF | |
411 creating http peer for wire protocol version 2 | |
412 sending changesetdata command | |
413 s> POST /api/exp-http-v2-0002/ro/changesetdata HTTP/1.1\r\n | |
414 s> Accept-Encoding: identity\r\n | |
415 s> accept: application/mercurial-exp-framing-0005\r\n | |
416 s> content-type: application/mercurial-exp-framing-0005\r\n | |
417 s> content-length: 74\r\n | |
418 s> host: $LOCALIP:$HGPORT\r\n (glob) | |
419 s> user-agent: Mercurial debugwireproto\r\n | |
420 s> \r\n | |
421 s> B\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa2Enodes\x81T\xea\xe5\xf8,.b#h\xd2}\xae\xcbv\xb7\xe3\x93\xd0\xf2B\x11Jnodesdepth\x02DnameMchangesetdata | |
422 s> makefile('rb', None) | |
423 s> HTTP/1.1 200 OK\r\n | |
424 s> Server: testing stub value\r\n | |
425 s> Date: $HTTP_DATE$\r\n | |
426 s> Content-Type: application/mercurial-exp-framing-0005\r\n | |
427 s> Transfer-Encoding: chunked\r\n | |
428 s> \r\n | |
429 s> 13\r\n | |
430 s> \x0b\x00\x00\x01\x00\x02\x011 | |
431 s> \xa1FstatusBok | |
432 s> \r\n | |
433 received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) | |
434 s> 4b\r\n | |
435 s> C\x00\x00\x01\x00\x02\x001 | |
436 s> \xa1Jtotalitems\x02\xa1DnodeT3\x90\xef\x85\x00s\xfb\xc2\xf0\xdf\xff"D4,\x8e\x92)\x01:\xa1DnodeT\xea\xe5\xf8,.b#h\xd2}\xae\xcbv\xb7\xe3\x93\xd0\xf2B\x11 | |
437 s> \r\n | |
438 received frame(size=67; request=1; stream=2; streamflags=; type=command-response; flags=continuation) | |
439 s> 8\r\n | |
440 s> \x00\x00\x00\x01\x00\x02\x002 | |
441 s> \r\n | |
442 s> 0\r\n | |
443 s> \r\n | |
444 received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) | |
445 response: gen[ | |
446 { | |
447 b'totalitems': 2 | |
448 }, | |
449 { | |
450 b'node': b'3\x90\xef\x85\x00s\xfb\xc2\xf0\xdf\xff"D4,\x8e\x92)\x01:' | |
451 }, | |
452 { | |
453 b'node': b'\xea\xe5\xf8,.b#h\xd2}\xae\xcbv\xb7\xe3\x93\xd0\xf2B\x11' | |
454 } | |
455 ] | |
456 | |
457 nodesdepth with multiple nodes | |
458 | |
459 $ sendhttpv2peer << EOF | |
460 > command changesetdata | |
461 > nodes eval:[b'\xea\xe5\xf8\x2c\x2e\x62\x23\x68\xd2\x7d\xae\xcb\x76\xb7\xe3\x93\xd0\xf2\x42\x11', b'\x0b\xb8\xad\x89\x4a\x15\xb1\x53\x80\xb2\xa2\xa5\xb1\x83\xe2\x0f\x2a\x4b\x28\xdd'] | |
462 > nodesdepth eval:2 | |
463 > EOF | |
464 creating http peer for wire protocol version 2 | |
465 sending changesetdata command | |
466 s> POST /api/exp-http-v2-0002/ro/changesetdata HTTP/1.1\r\n | |
467 s> Accept-Encoding: identity\r\n | |
468 s> accept: application/mercurial-exp-framing-0005\r\n | |
469 s> content-type: application/mercurial-exp-framing-0005\r\n | |
470 s> content-length: 95\r\n | |
471 s> host: $LOCALIP:$HGPORT\r\n (glob) | |
472 s> user-agent: Mercurial debugwireproto\r\n | |
473 s> \r\n | |
474 s> W\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa2Enodes\x82T\xea\xe5\xf8,.b#h\xd2}\xae\xcbv\xb7\xe3\x93\xd0\xf2B\x11T\x0b\xb8\xad\x89J\x15\xb1S\x80\xb2\xa2\xa5\xb1\x83\xe2\x0f*K(\xddJnodesdepth\x02DnameMchangesetdata | |
475 s> makefile('rb', None) | |
476 s> HTTP/1.1 200 OK\r\n | |
477 s> Server: testing stub value\r\n | |
478 s> Date: $HTTP_DATE$\r\n | |
479 s> Content-Type: application/mercurial-exp-framing-0005\r\n | |
480 s> Transfer-Encoding: chunked\r\n | |
481 s> \r\n | |
482 s> 13\r\n | |
483 s> \x0b\x00\x00\x01\x00\x02\x011 | |
484 s> \xa1FstatusBok | |
485 s> \r\n | |
486 received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) | |
487 s> 81\r\n | |
488 s> y\x00\x00\x01\x00\x02\x001 | |
489 s> \xa1Jtotalitems\x04\xa1DnodeT3\x90\xef\x85\x00s\xfb\xc2\xf0\xdf\xff"D4,\x8e\x92)\x01:\xa1DnodeTu\x92\x91~\x1c>\x82g|\xb0\xa4\xbcq\\\xa2]\xd1-(\xc1\xa1DnodeT\x0b\xb8\xad\x89J\x15\xb1S\x80\xb2\xa2\xa5\xb1\x83\xe2\x0f*K(\xdd\xa1DnodeT\xea\xe5\xf8,.b#h\xd2}\xae\xcbv\xb7\xe3\x93\xd0\xf2B\x11 | |
490 s> \r\n | |
491 received frame(size=121; request=1; stream=2; streamflags=; type=command-response; flags=continuation) | |
492 s> 8\r\n | |
493 s> \x00\x00\x00\x01\x00\x02\x002 | |
494 s> \r\n | |
495 s> 0\r\n | |
496 s> \r\n | |
497 received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) | |
498 response: gen[ | |
499 { | |
500 b'totalitems': 4 | |
501 }, | |
502 { | |
503 b'node': b'3\x90\xef\x85\x00s\xfb\xc2\xf0\xdf\xff"D4,\x8e\x92)\x01:' | |
504 }, | |
505 { | |
506 b'node': b'u\x92\x91~\x1c>\x82g|\xb0\xa4\xbcq\\\xa2]\xd1-(\xc1' | |
507 }, | |
508 { | |
509 b'node': b'\x0b\xb8\xad\x89J\x15\xb1S\x80\xb2\xa2\xa5\xb1\x83\xe2\x0f*K(\xdd' | |
510 }, | |
511 { | |
512 b'node': b'\xea\xe5\xf8,.b#h\xd2}\xae\xcbv\xb7\xe3\x93\xd0\xf2B\x11' | |
316 } | 513 } |
317 ] | 514 ] |
318 | 515 |
319 Parents data is transferred upon request | 516 Parents data is transferred upon request |
320 | 517 |