Show More
@@ -110,6 +110,9 b' fields' | |||||
110 | (set of bytestring) Which data associated with changelog revisions to |
|
110 | (set of bytestring) Which data associated with changelog revisions to | |
111 | fetch. The following values are recognized: |
|
111 | fetch. The following values are recognized: | |
112 |
|
112 | |||
|
113 | bookmarks | |||
|
114 | Bookmarks associated with a revision. | |||
|
115 | ||||
113 | parents |
|
116 | parents | |
114 | Parent revisions. |
|
117 | Parent revisions. | |
115 |
|
118 | |||
@@ -144,6 +147,11 b' node' | |||||
144 | (bytestring) The node value for this revision. This is the SHA-1 hash of |
|
147 | (bytestring) The node value for this revision. This is the SHA-1 hash of | |
145 | the raw revision data. |
|
148 | the raw revision data. | |
146 |
|
149 | |||
|
150 | bookmarks (optional) | |||
|
151 | (array of bytestrings) Bookmarks attached to this revision. Only present | |||
|
152 | if ``bookmarks`` data is being requested and the revision has bookmarks | |||
|
153 | attached. | |||
|
154 | ||||
147 | parents (optional) |
|
155 | parents (optional) | |
148 | (array of bytestrings) The nodes representing the parent revisions of this |
|
156 | (array of bytestrings) The nodes representing the parent revisions of this | |
149 | revision. Only present if ``parents`` data is being requested. |
|
157 | revision. Only present if ``parents`` data is being requested. | |
@@ -182,7 +190,6 b' to reflect a phase-only update.' | |||||
182 | TODO support different revision selection mechanisms (e.g. non-public, specific |
|
190 | TODO support different revision selection mechanisms (e.g. non-public, specific | |
183 | revisions) |
|
191 | revisions) | |
184 | TODO support different hash "namespaces" for revisions (e.g. sha-1 versus other) |
|
192 | TODO support different hash "namespaces" for revisions (e.g. sha-1 versus other) | |
185 | TODO support emitting bookmarks data |
|
|||
186 | TODO support emitting obsolescence data |
|
193 | TODO support emitting obsolescence data | |
187 | TODO support filtering based on relevant paths (narrow clone) |
|
194 | TODO support filtering based on relevant paths (narrow clone) | |
188 | TODO support depth limiting |
|
195 | TODO support depth limiting |
@@ -533,6 +533,10 b' def changesetdata(repo, proto, noderange' | |||||
533 | b'phase': b'public' if publishing else repo[node].phasestr() |
|
533 | b'phase': b'public' if publishing else repo[node].phasestr() | |
534 | } |
|
534 | } | |
535 |
|
535 | |||
|
536 | nodebookmarks = {} | |||
|
537 | for mark, node in repo._bookmarks.items(): | |||
|
538 | nodebookmarks.setdefault(node, set()).add(mark) | |||
|
539 | ||||
536 | # It is already topologically sorted by revision number. |
|
540 | # It is already topologically sorted by revision number. | |
537 | for node in outgoing: |
|
541 | for node in outgoing: | |
538 | d = { |
|
542 | d = { | |
@@ -549,6 +553,10 b' def changesetdata(repo, proto, noderange' | |||||
549 | ctx = repo[node] |
|
553 | ctx = repo[node] | |
550 | d[b'phase'] = ctx.phasestr() |
|
554 | d[b'phase'] = ctx.phasestr() | |
551 |
|
555 | |||
|
556 | if b'bookmarks' in fields and node in nodebookmarks: | |||
|
557 | d[b'bookmarks'] = sorted(nodebookmarks[node]) | |||
|
558 | del nodebookmarks[node] | |||
|
559 | ||||
552 | revisiondata = None |
|
560 | revisiondata = None | |
553 |
|
561 | |||
554 | if b'revision' in fields: |
|
562 | if b'revision' in fields: | |
@@ -560,6 +568,15 b' def changesetdata(repo, proto, noderange' | |||||
560 | if revisiondata is not None: |
|
568 | if revisiondata is not None: | |
561 | yield revisiondata |
|
569 | yield revisiondata | |
562 |
|
570 | |||
|
571 | # If requested, send bookmarks from nodes that didn't have revision | |||
|
572 | # data sent so receiver is aware of any bookmark updates. | |||
|
573 | if b'bookmarks' in fields: | |||
|
574 | for node, marks in sorted(nodebookmarks.iteritems()): | |||
|
575 | yield { | |||
|
576 | b'node': node, | |||
|
577 | b'bookmarks': sorted(marks), | |||
|
578 | } | |||
|
579 | ||||
563 | @wireprotocommand('heads', |
|
580 | @wireprotocommand('heads', | |
564 | args={ |
|
581 | args={ | |
565 | 'publiconly': False, |
|
582 | 'publiconly': False, |
@@ -478,6 +478,213 b' Revision data is transferred upon reques' | |||||
478 | b'1b74476799ec8318045db759b1b4bcc9b839d0aa\ntest\n0 0\na\n\ncommit 3' |
|
478 | b'1b74476799ec8318045db759b1b4bcc9b839d0aa\ntest\n0 0\na\n\ncommit 3' | |
479 | ] |
|
479 | ] | |
480 |
|
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 | } | |||
|
686 | ] | |||
|
687 | ||||
481 | Multiple fields can be transferred |
|
688 | Multiple fields can be transferred | |
482 |
|
689 | |||
483 | $ sendhttpv2peer << EOF |
|
690 | $ sendhttpv2peer << EOF |
General Comments 0
You need to be logged in to leave comments.
Login now