Show More
@@ -344,7 +344,7 b' class bundle20(object):' | |||||
344 | self.ui = ui |
|
344 | self.ui = ui | |
345 | self._params = [] |
|
345 | self._params = [] | |
346 | self._parts = [] |
|
346 | self._parts = [] | |
347 |
self.capabilities = |
|
347 | self.capabilities = dict(capabilities) | |
348 |
|
348 | |||
349 | def addparam(self, name, value=None): |
|
349 | def addparam(self, name, value=None): | |
350 | """add a stream level parameter""" |
|
350 | """add a stream level parameter""" | |
@@ -697,8 +697,22 b' def handleoutput(op, inpart):' | |||||
697 | def handlereplycaps(op, inpart): |
|
697 | def handlereplycaps(op, inpart): | |
698 | """Notify that a reply bundle should be created |
|
698 | """Notify that a reply bundle should be created | |
699 |
|
699 | |||
700 |
|
|
700 | The part payload is a list of capabilities (one per line) | |
701 | caps = [c for c in inpart.read().splitlines() if c] |
|
701 | Capabilities may have values using a line of form:: | |
|
702 | ||||
|
703 | capability=value1,value2,value3 | |||
|
704 | ||||
|
705 | The value are alway a list.""" | |||
|
706 | caps = {} | |||
|
707 | for line in inpart.read().splitlines(): | |||
|
708 | if not line: | |||
|
709 | continue | |||
|
710 | if '=' not in line: | |||
|
711 | key, vals = line, () | |||
|
712 | else: | |||
|
713 | key, vals = line.split('=', 1) | |||
|
714 | vals = vals.split(',') | |||
|
715 | caps[key] = vals | |||
702 | if op.reply is None: |
|
716 | if op.reply is None: | |
703 | op.reply = bundle20(op.ui, caps) |
|
717 | op.reply = bundle20(op.ui, caps) | |
704 |
|
718 |
@@ -51,6 +51,9 b' Create an extension to test bundle2 API' | |||||
51 | > op.ui.write('debugreply: capabilities:\n') |
|
51 | > op.ui.write('debugreply: capabilities:\n') | |
52 | > for cap in sorted(op.reply.capabilities): |
|
52 | > for cap in sorted(op.reply.capabilities): | |
53 | > op.ui.write('debugreply: %r\n' % cap) |
|
53 | > op.ui.write('debugreply: %r\n' % cap) | |
|
54 | > for val in op.reply.capabilities[cap]: | |||
|
55 | > op.ui.write('debugreply: %r\n' % val) | |||
|
56 | > | |||
54 | > @command('bundle2', |
|
57 | > @command('bundle2', | |
55 | > [('', 'param', [], 'stream level parameter'), |
|
58 | > [('', 'param', [], 'stream level parameter'), | |
56 | > ('', 'unknown', False, 'include an unknown mandatory part in the bundle'), |
|
59 | > ('', 'unknown', False, 'include an unknown mandatory part in the bundle'), | |
@@ -69,7 +72,7 b' Create an extension to test bundle2 API' | |||||
69 | > raise util.Abort('%s' % exc) |
|
72 | > raise util.Abort('%s' % exc) | |
70 | > |
|
73 | > | |
71 | > if opts['reply']: |
|
74 | > if opts['reply']: | |
72 | > capsstring = 'ping-pong\nelephants' |
|
75 | > capsstring = 'ping-pong\nelephants=babar,celeste\ncity=celesteville' | |
73 | > bundler.addpart(bundle2.bundlepart('replycaps', data=capsstring)) |
|
76 | > bundler.addpart(bundle2.bundlepart('replycaps', data=capsstring)) | |
74 | > |
|
77 | > | |
75 | > revs = opts['rev'] |
|
78 | > revs = opts['rev'] | |
@@ -544,8 +547,12 b' The reply is a bundle' | |||||
544 | Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko |
|
547 | Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko | |
545 | Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko |
|
548 | Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko | |
546 | Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko. |
|
549 | Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko. | |
547 |
\x00\x00\x00\x00\x00\x1b\x06output\x00\x00\x00\x01\x00\x01\x0b\x01in-reply-to4\x00\x00\x00 |
|
550 | \x00\x00\x00\x00\x00\x1b\x06output\x00\x00\x00\x01\x00\x01\x0b\x01in-reply-to4\x00\x00\x00\xc6debugreply: capabilities: (esc) | |
|
551 | debugreply: 'city' | |||
|
552 | debugreply: 'celesteville' | |||
548 | debugreply: 'elephants' |
|
553 | debugreply: 'elephants' | |
|
554 | debugreply: 'babar' | |||
|
555 | debugreply: 'celeste' | |||
549 | debugreply: 'ping-pong' |
|
556 | debugreply: 'ping-pong' | |
550 | \x00\x00\x00\x00\x00\x1e test:pong\x00\x00\x00\x02\x01\x00\x0b\x01in-reply-to6\x00\x00\x00\x00\x00\x1b\x06output\x00\x00\x00\x03\x00\x01\x0b\x01in-reply-to6\x00\x00\x00=received ping request (id 6) (esc) |
|
557 | \x00\x00\x00\x00\x00\x1e test:pong\x00\x00\x00\x02\x01\x00\x0b\x01in-reply-to6\x00\x00\x00\x00\x00\x1b\x06output\x00\x00\x00\x03\x00\x01\x0b\x01in-reply-to6\x00\x00\x00=received ping request (id 6) (esc) | |
551 | replying to ping request (id 6) |
|
558 | replying to ping request (id 6) | |
@@ -562,7 +569,7 b' The reply is valid' | |||||
562 | :output: |
|
569 | :output: | |
563 | mandatory: 0 |
|
570 | mandatory: 0 | |
564 | advisory: 1 |
|
571 | advisory: 1 | |
565 |
payload: 8 |
|
572 | payload: 198 bytes | |
566 | :test:pong: |
|
573 | :test:pong: | |
567 | mandatory: 1 |
|
574 | mandatory: 1 | |
568 | advisory: 0 |
|
575 | advisory: 0 | |
@@ -581,7 +588,11 b' Unbundle the reply to get the output:' | |||||
581 | remote: Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko |
|
588 | remote: Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko | |
582 | remote: Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko. |
|
589 | remote: Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko. | |
583 | remote: debugreply: capabilities: |
|
590 | remote: debugreply: capabilities: | |
|
591 | remote: debugreply: 'city' | |||
|
592 | remote: debugreply: 'celesteville' | |||
584 | remote: debugreply: 'elephants' |
|
593 | remote: debugreply: 'elephants' | |
|
594 | remote: debugreply: 'babar' | |||
|
595 | remote: debugreply: 'celeste' | |||
585 | remote: debugreply: 'ping-pong' |
|
596 | remote: debugreply: 'ping-pong' | |
586 | remote: received ping request (id 6) |
|
597 | remote: received ping request (id 6) | |
587 | remote: replying to ping request (id 6) |
|
598 | remote: replying to ping request (id 6) |
General Comments 0
You need to be logged in to leave comments.
Login now