Mercurial > hg
comparison tests/test-wireproto-command-changesetdata.t @ 39634:9dffa99f9158
wireprotov2: add bookmarks to "changesetdata" command
Like we did for phases, we want to emit bookmarks data attached
to each changeset.
The approach here is very similar to phases: we emit bookmarks
data inline with requested revision data. But we emit
records for nodes that weren't requested as well so consumers have
access to the full set of defined bookmarks.
Differential Revision: https://phab.mercurial-scm.org/D4485
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 23 Aug 2018 18:14:19 -0700 |
parents | c1aacb0d76ff |
children | d059cb669632 |
comparison
equal
deleted
inserted
replaced
39633:ff2de4f2eb3c | 39634:9dffa99f9158 |
---|---|
474 { | 474 { |
475 b'node': b'\xea\xe5\xf8,.b#h\xd2}\xae\xcbv\xb7\xe3\x93\xd0\xf2B\x11', | 475 b'node': b'\xea\xe5\xf8,.b#h\xd2}\xae\xcbv\xb7\xe3\x93\xd0\xf2B\x11', |
476 b'revisionsize': 61 | 476 b'revisionsize': 61 |
477 }, | 477 }, |
478 b'1b74476799ec8318045db759b1b4bcc9b839d0aa\ntest\n0 0\na\n\ncommit 3' | 478 b'1b74476799ec8318045db759b1b4bcc9b839d0aa\ntest\n0 0\na\n\ncommit 3' |
479 ] | |
480 | |
481 Bookmarks key isn't present if no bookmarks data | |
482 | |
483 $ sendhttpv2peer << EOF | |
484 > command changesetdata | |
485 > fields eval:[b'bookmarks'] | |
486 > 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']] | |
487 > EOF | |
488 creating http peer for wire protocol version 2 | |
489 sending changesetdata command | |
490 s> POST /api/exp-http-v2-0001/ro/changesetdata HTTP/1.1\r\n | |
491 s> Accept-Encoding: identity\r\n | |
492 s> accept: application/mercurial-exp-framing-0005\r\n | |
493 s> content-type: application/mercurial-exp-framing-0005\r\n | |
494 s> content-length: 107\r\n | |
495 s> host: $LOCALIP:$HGPORT\r\n (glob) | |
496 s> user-agent: Mercurial debugwireproto\r\n | |
497 s> \r\n | |
498 s> c\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa2Ffields\x81IbookmarksInoderange\x82\x80\x82T\x0b\xb8\xad\x89J\x15\xb1S\x80\xb2\xa2\xa5\xb1\x83\xe2\x0f*K(\xddT\xea\xe5\xf8,.b#h\xd2}\xae\xcbv\xb7\xe3\x93\xd0\xf2B\x11DnameMchangesetdata | |
499 s> makefile('rb', None) | |
500 s> HTTP/1.1 200 OK\r\n | |
501 s> Server: testing stub value\r\n | |
502 s> Date: $HTTP_DATE$\r\n | |
503 s> Content-Type: application/mercurial-exp-framing-0005\r\n | |
504 s> Transfer-Encoding: chunked\r\n | |
505 s> \r\n | |
506 s> 13\r\n | |
507 s> \x0b\x00\x00\x01\x00\x02\x011 | |
508 s> \xa1FstatusBok | |
509 s> \r\n | |
510 received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) | |
511 s> 81\r\n | |
512 s> y\x00\x00\x01\x00\x02\x001 | |
513 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 | |
514 s> \r\n | |
515 received frame(size=121; request=1; stream=2; streamflags=; type=command-response; flags=continuation) | |
516 s> 8\r\n | |
517 s> \x00\x00\x00\x01\x00\x02\x002 | |
518 s> \r\n | |
519 s> 0\r\n | |
520 s> \r\n | |
521 received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) | |
522 response: gen[ | |
523 { | |
524 b'totalitems': 4 | |
525 }, | |
526 { | |
527 b'node': b'3\x90\xef\x85\x00s\xfb\xc2\xf0\xdf\xff"D4,\x8e\x92)\x01:' | |
528 }, | |
529 { | |
530 b'node': b'u\x92\x91~\x1c>\x82g|\xb0\xa4\xbcq\\\xa2]\xd1-(\xc1' | |
531 }, | |
532 { | |
533 b'node': b'\x0b\xb8\xad\x89J\x15\xb1S\x80\xb2\xa2\xa5\xb1\x83\xe2\x0f*K(\xdd' | |
534 }, | |
535 { | |
536 b'node': b'\xea\xe5\xf8,.b#h\xd2}\xae\xcbv\xb7\xe3\x93\xd0\xf2B\x11' | |
537 } | |
538 ] | |
539 | |
540 Bookmarks are sent when requested | |
541 | |
542 $ hg -R ../server bookmark -r 0bb8ad894a15b15380b2a2a5b183e20f2a4b28dd book-1 | |
543 $ hg -R ../server bookmark -r eae5f82c2e622368d27daecb76b7e393d0f24211 book-2 | |
544 $ hg -R ../server bookmark -r eae5f82c2e622368d27daecb76b7e393d0f24211 book-3 | |
545 | |
546 $ sendhttpv2peer << EOF | |
547 > command changesetdata | |
548 > fields eval:[b'bookmarks'] | |
549 > 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']] | |
550 > EOF | |
551 creating http peer for wire protocol version 2 | |
552 sending changesetdata command | |
553 s> POST /api/exp-http-v2-0001/ro/changesetdata HTTP/1.1\r\n | |
554 s> Accept-Encoding: identity\r\n | |
555 s> accept: application/mercurial-exp-framing-0005\r\n | |
556 s> content-type: application/mercurial-exp-framing-0005\r\n | |
557 s> content-length: 107\r\n | |
558 s> host: $LOCALIP:$HGPORT\r\n (glob) | |
559 s> user-agent: Mercurial debugwireproto\r\n | |
560 s> \r\n | |
561 s> c\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa2Ffields\x81IbookmarksInoderange\x82\x80\x82T\x0b\xb8\xad\x89J\x15\xb1S\x80\xb2\xa2\xa5\xb1\x83\xe2\x0f*K(\xddT\xea\xe5\xf8,.b#h\xd2}\xae\xcbv\xb7\xe3\x93\xd0\xf2B\x11DnameMchangesetdata | |
562 s> makefile('rb', None) | |
563 s> HTTP/1.1 200 OK\r\n | |
564 s> Server: testing stub value\r\n | |
565 s> Date: $HTTP_DATE$\r\n | |
566 s> Content-Type: application/mercurial-exp-framing-0005\r\n | |
567 s> Transfer-Encoding: chunked\r\n | |
568 s> \r\n | |
569 s> 13\r\n | |
570 s> \x0b\x00\x00\x01\x00\x02\x011 | |
571 s> \xa1FstatusBok | |
572 s> \r\n | |
573 received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) | |
574 s> ac\r\n | |
575 s> \xa4\x00\x00\x01\x00\x02\x001 | |
576 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\xa2Ibookmarks\x81Fbook-1DnodeT\x0b\xb8\xad\x89J\x15\xb1S\x80\xb2\xa2\xa5\xb1\x83\xe2\x0f*K(\xdd\xa2Ibookmarks\x82Fbook-2Fbook-3DnodeT\xea\xe5\xf8,.b#h\xd2}\xae\xcbv\xb7\xe3\x93\xd0\xf2B\x11 | |
577 s> \r\n | |
578 received frame(size=164; request=1; stream=2; streamflags=; type=command-response; flags=continuation) | |
579 s> 8\r\n | |
580 s> \x00\x00\x00\x01\x00\x02\x002 | |
581 s> \r\n | |
582 s> 0\r\n | |
583 s> \r\n | |
584 received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) | |
585 response: gen[ | |
586 { | |
587 b'totalitems': 4 | |
588 }, | |
589 { | |
590 b'node': b'3\x90\xef\x85\x00s\xfb\xc2\xf0\xdf\xff"D4,\x8e\x92)\x01:' | |
591 }, | |
592 { | |
593 b'node': b'u\x92\x91~\x1c>\x82g|\xb0\xa4\xbcq\\\xa2]\xd1-(\xc1' | |
594 }, | |
595 { | |
596 b'bookmarks': [ | |
597 b'book-1' | |
598 ], | |
599 b'node': b'\x0b\xb8\xad\x89J\x15\xb1S\x80\xb2\xa2\xa5\xb1\x83\xe2\x0f*K(\xdd' | |
600 }, | |
601 { | |
602 b'bookmarks': [ | |
603 b'book-2', | |
604 b'book-3' | |
605 ], | |
606 b'node': b'\xea\xe5\xf8,.b#h\xd2}\xae\xcbv\xb7\xe3\x93\xd0\xf2B\x11' | |
607 } | |
608 ] | |
609 | |
610 Bookmarks are sent when we make a no-new-revisions request | |
611 | |
612 $ sendhttpv2peer << EOF | |
613 > command changesetdata | |
614 > fields eval:[b'bookmarks', b'revision'] | |
615 > noderange 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', b'\xea\xe5\xf8\x2c\x2e\x62\x23\x68\xd2\x7d\xae\xcb\x76\xb7\xe3\x93\xd0\xf2\x42\x11']] | |
616 > EOF | |
617 creating http peer for wire protocol version 2 | |
618 sending changesetdata command | |
619 s> POST /api/exp-http-v2-0001/ro/changesetdata HTTP/1.1\r\n | |
620 s> Accept-Encoding: identity\r\n | |
621 s> accept: application/mercurial-exp-framing-0005\r\n | |
622 s> content-type: application/mercurial-exp-framing-0005\r\n | |
623 s> content-length: 137\r\n | |
624 s> host: $LOCALIP:$HGPORT\r\n (glob) | |
625 s> user-agent: Mercurial debugwireproto\r\n | |
626 s> \r\n | |
627 s> \x81\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa2Ffields\x82IbookmarksHrevisionInoderange\x82\x81T\xea\xe5\xf8,.b#h\xd2}\xae\xcbv\xb7\xe3\x93\xd0\xf2B\x11\x82T\x0b\xb8\xad\x89J\x15\xb1S\x80\xb2\xa2\xa5\xb1\x83\xe2\x0f*K(\xddT\xea\xe5\xf8,.b#h\xd2}\xae\xcbv\xb7\xe3\x93\xd0\xf2B\x11DnameMchangesetdata | |
628 s> makefile('rb', None) | |
629 s> HTTP/1.1 200 OK\r\n | |
630 s> Server: testing stub value\r\n | |
631 s> Date: $HTTP_DATE$\r\n | |
632 s> Content-Type: application/mercurial-exp-framing-0005\r\n | |
633 s> Transfer-Encoding: chunked\r\n | |
634 s> \r\n | |
635 s> 13\r\n | |
636 s> \x0b\x00\x00\x01\x00\x02\x011 | |
637 s> \xa1FstatusBok | |
638 s> \r\n | |
639 received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) | |
640 s> 12f\r\n | |
641 s> \'\x01\x00\x01\x00\x02\x001 | |
642 s> \xa1Jtotalitems\x02\xa2DnodeTu\x92\x91~\x1c>\x82g|\xb0\xa4\xbcq\\\xa2]\xd1-(\xc1Lrevisionsize\x18?X?7f144aea0ba742713887b564d57e9d12f12ff382\n | |
643 s> test\n | |
644 s> 0 0\n | |
645 s> a\n | |
646 s> b\n | |
647 s> \n | |
648 s> commit 1\xa3Ibookmarks\x81Fbook-1DnodeT\x0b\xb8\xad\x89J\x15\xb1S\x80\xb2\xa2\xa5\xb1\x83\xe2\x0f*K(\xddLrevisionsize\x18=X=37f0a2d1c28ffe4b879109a7d1bbf8f07b3c763b\n | |
649 s> test\n | |
650 s> 0 0\n | |
651 s> b\n | |
652 s> \n | |
653 s> commit 2\xa2Ibookmarks\x82Fbook-2Fbook-3DnodeT\xea\xe5\xf8,.b#h\xd2}\xae\xcbv\xb7\xe3\x93\xd0\xf2B\x11 | |
654 s> \r\n | |
655 received frame(size=295; request=1; stream=2; streamflags=; type=command-response; flags=continuation) | |
656 s> 8\r\n | |
657 s> \x00\x00\x00\x01\x00\x02\x002 | |
658 s> \r\n | |
659 s> 0\r\n | |
660 s> \r\n | |
661 received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) | |
662 response: gen[ | |
663 { | |
664 b'totalitems': 2 | |
665 }, | |
666 { | |
667 b'node': b'u\x92\x91~\x1c>\x82g|\xb0\xa4\xbcq\\\xa2]\xd1-(\xc1', | |
668 b'revisionsize': 63 | |
669 }, | |
670 b'7f144aea0ba742713887b564d57e9d12f12ff382\ntest\n0 0\na\nb\n\ncommit 1', | |
671 { | |
672 b'bookmarks': [ | |
673 b'book-1' | |
674 ], | |
675 b'node': b'\x0b\xb8\xad\x89J\x15\xb1S\x80\xb2\xa2\xa5\xb1\x83\xe2\x0f*K(\xdd', | |
676 b'revisionsize': 61 | |
677 }, | |
678 b'37f0a2d1c28ffe4b879109a7d1bbf8f07b3c763b\ntest\n0 0\nb\n\ncommit 2', | |
679 { | |
680 b'bookmarks': [ | |
681 b'book-2', | |
682 b'book-3' | |
683 ], | |
684 b'node': b'\xea\xe5\xf8,.b#h\xd2}\xae\xcbv\xb7\xe3\x93\xd0\xf2B\x11' | |
685 } | |
479 ] | 686 ] |
480 | 687 |
481 Multiple fields can be transferred | 688 Multiple fields can be transferred |
482 | 689 |
483 $ sendhttpv2peer << EOF | 690 $ sendhttpv2peer << EOF |