Show More
@@ -697,7 +697,8 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 | Will convey bundle capability at some point too.""" |
|
700 | the part payload is a list of capabilities (one per line)""" | |
|
701 | caps = [c for c in inpart.read().splitlines() if c] | |||
701 | if op.reply is None: |
|
702 | if op.reply is None: | |
702 | op.reply = bundle20(op.ui) |
|
703 | op.reply = bundle20(op.ui, caps) | |
703 |
|
704 |
@@ -36,12 +36,21 b' Create an extension to test bundle2 API' | |||||
36 | > @bundle2.parthandler('test:ping') |
|
36 | > @bundle2.parthandler('test:ping') | |
37 | > def pinghandler(op, part): |
|
37 | > def pinghandler(op, part): | |
38 | > op.ui.write('received ping request (id %i)\n' % part.id) |
|
38 | > op.ui.write('received ping request (id %i)\n' % part.id) | |
39 | > if op.reply is not None: |
|
39 | > if op.reply is not None and 'ping-pong' in op.reply.capabilities: | |
40 | > op.ui.write_err('replying to ping request (id %i)\n' % part.id) |
|
40 | > op.ui.write_err('replying to ping request (id %i)\n' % part.id) | |
41 | > rpart = bundle2.bundlepart('test:pong', |
|
41 | > rpart = bundle2.bundlepart('test:pong', | |
42 | > [('in-reply-to', str(part.id))]) |
|
42 | > [('in-reply-to', str(part.id))]) | |
43 | > op.reply.addpart(rpart) |
|
43 | > op.reply.addpart(rpart) | |
44 | > |
|
44 | > | |
|
45 | > @bundle2.parthandler('test:debugreply') | |||
|
46 | > def debugreply(op, part): | |||
|
47 | > """print data about the capacity of the bundle reply""" | |||
|
48 | > if op.reply is None: | |||
|
49 | > op.ui.write('debugreply: no reply\n') | |||
|
50 | > else: | |||
|
51 | > op.ui.write('debugreply: capabilities:\n') | |||
|
52 | > for cap in sorted(op.reply.capabilities): | |||
|
53 | > op.ui.write('debugreply: %r\n' % cap) | |||
45 | > @command('bundle2', |
|
54 | > @command('bundle2', | |
46 | > [('', 'param', [], 'stream level parameter'), |
|
55 | > [('', 'param', [], 'stream level parameter'), | |
47 | > ('', 'unknown', False, 'include an unknown mandatory part in the bundle'), |
|
56 | > ('', 'unknown', False, 'include an unknown mandatory part in the bundle'), | |
@@ -60,7 +69,8 b' Create an extension to test bundle2 API' | |||||
60 | > raise util.Abort('%s' % exc) |
|
69 | > raise util.Abort('%s' % exc) | |
61 | > |
|
70 | > | |
62 | > if opts['reply']: |
|
71 | > if opts['reply']: | |
63 | > bundler.addpart(bundle2.bundlepart('replycaps')) |
|
72 | > capsstring = 'ping-pong\nelephants' | |
|
73 | > bundler.addpart(bundle2.bundlepart('replycaps', data=capsstring)) | |||
64 | > |
|
74 | > | |
65 | > revs = opts['rev'] |
|
75 | > revs = opts['rev'] | |
66 | > if 'rev' in opts: |
|
76 | > if 'rev' in opts: | |
@@ -83,6 +93,8 b' Create an extension to test bundle2 API' | |||||
83 | > bundler.addpart(part) |
|
93 | > bundler.addpart(part) | |
84 | > part = bundle2.bundlepart('test:song', data=ELEPHANTSSONG) |
|
94 | > part = bundle2.bundlepart('test:song', data=ELEPHANTSSONG) | |
85 | > bundler.addpart(part) |
|
95 | > bundler.addpart(part) | |
|
96 | > part = bundle2.bundlepart('test:debugreply') | |||
|
97 | > bundler.addpart(part) | |||
86 | > part = bundle2.bundlepart('test:math', |
|
98 | > part = bundle2.bundlepart('test:math', | |
87 | > [('pi', '3.14'), ('e', '2.72')], |
|
99 | > [('pi', '3.14'), ('e', '2.72')], | |
88 | > [('cooking', 'raw')], |
|
100 | > [('cooking', 'raw')], | |
@@ -339,6 +351,7 b' Test part' | |||||
339 | bundle part: "test:empty" |
|
351 | bundle part: "test:empty" | |
340 | bundle part: "test:empty" |
|
352 | bundle part: "test:empty" | |
341 | bundle part: "test:song" |
|
353 | bundle part: "test:song" | |
|
354 | bundle part: "test:debugreply" | |||
342 | bundle part: "test:math" |
|
355 | bundle part: "test:math" | |
343 | bundle part: "test:ping" |
|
356 | bundle part: "test:ping" | |
344 | end of bundle |
|
357 | end of bundle | |
@@ -348,7 +361,7 b' Test part' | |||||
348 | test:empty\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11 (esc) |
|
361 | test:empty\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11 (esc) | |
349 | test:empty\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x10 test:song\x00\x00\x00\x02\x00\x00\x00\x00\x00\xb2Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko (esc) |
|
362 | test:empty\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x10 test:song\x00\x00\x00\x02\x00\x00\x00\x00\x00\xb2Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko (esc) | |
350 | Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko |
|
363 | Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko | |
351 |
Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.\x00\x00\x00\x00\x00+ test:math\x00\x00\x00\x0 |
|
364 | Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.\x00\x00\x00\x00\x00\x16\x0ftest:debugreply\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00+ test:math\x00\x00\x00\x04\x02\x01\x02\x04\x01\x04\x07\x03pi3.14e2.72cookingraw\x00\x00\x00\x0242\x00\x00\x00\x00\x00\x10 test:ping\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc) | |
352 |
|
365 | |||
353 |
|
366 | |||
354 | $ hg statbundle2 < ../parts.hg2 |
|
367 | $ hg statbundle2 < ../parts.hg2 | |
@@ -365,6 +378,10 b' Test part' | |||||
365 | mandatory: 0 |
|
378 | mandatory: 0 | |
366 | advisory: 0 |
|
379 | advisory: 0 | |
367 | payload: 178 bytes |
|
380 | payload: 178 bytes | |
|
381 | :test:debugreply: | |||
|
382 | mandatory: 0 | |||
|
383 | advisory: 0 | |||
|
384 | payload: 0 bytes | |||
368 | :test:math: |
|
385 | :test:math: | |
369 | mandatory: 2 |
|
386 | mandatory: 2 | |
370 | advisory: 1 |
|
387 | advisory: 1 | |
@@ -373,7 +390,7 b' Test part' | |||||
373 | mandatory: 0 |
|
390 | mandatory: 0 | |
374 | advisory: 0 |
|
391 | advisory: 0 | |
375 | payload: 0 bytes |
|
392 | payload: 0 bytes | |
376 |
parts count: |
|
393 | parts count: 6 | |
377 |
|
394 | |||
378 | $ hg statbundle2 --debug < ../parts.hg2 |
|
395 | $ hg statbundle2 --debug < ../parts.hg2 | |
379 | start processing of HG20 stream |
|
396 | start processing of HG20 stream | |
@@ -408,9 +425,18 b' Test part' | |||||
408 | payload chunk size: 178 |
|
425 | payload chunk size: 178 | |
409 | payload chunk size: 0 |
|
426 | payload chunk size: 0 | |
410 | payload: 178 bytes |
|
427 | payload: 178 bytes | |
|
428 | part header size: 22 | |||
|
429 | part type: "test:debugreply" | |||
|
430 | part id: "3" | |||
|
431 | part parameters: 0 | |||
|
432 | :test:debugreply: | |||
|
433 | mandatory: 0 | |||
|
434 | advisory: 0 | |||
|
435 | payload chunk size: 0 | |||
|
436 | payload: 0 bytes | |||
411 | part header size: 43 |
|
437 | part header size: 43 | |
412 | part type: "test:math" |
|
438 | part type: "test:math" | |
413 |
part id: " |
|
439 | part id: "4" | |
414 | part parameters: 3 |
|
440 | part parameters: 3 | |
415 | :test:math: |
|
441 | :test:math: | |
416 | mandatory: 2 |
|
442 | mandatory: 2 | |
@@ -420,7 +446,7 b' Test part' | |||||
420 | payload: 2 bytes |
|
446 | payload: 2 bytes | |
421 | part header size: 16 |
|
447 | part header size: 16 | |
422 | part type: "test:ping" |
|
448 | part type: "test:ping" | |
423 |
part id: " |
|
449 | part id: "5" | |
424 | part parameters: 0 |
|
450 | part parameters: 0 | |
425 | :test:ping: |
|
451 | :test:ping: | |
426 | mandatory: 0 |
|
452 | mandatory: 0 | |
@@ -429,7 +455,7 b' Test part' | |||||
429 | payload: 0 bytes |
|
455 | payload: 0 bytes | |
430 | part header size: 0 |
|
456 | part header size: 0 | |
431 | end of bundle2 stream |
|
457 | end of bundle2 stream | |
432 |
parts count: |
|
458 | parts count: 6 | |
433 |
|
459 | |||
434 | Test actual unbundling of test part |
|
460 | Test actual unbundling of test part | |
435 | ======================================= |
|
461 | ======================================= | |
@@ -463,19 +489,26 b' Process the bundle' | |||||
463 | Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko |
|
489 | Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko | |
464 | Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko |
|
490 | Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko | |
465 | Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko. |
|
491 | Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko. | |
|
492 | part header size: 22 | |||
|
493 | part type: "test:debugreply" | |||
|
494 | part id: "3" | |||
|
495 | part parameters: 0 | |||
|
496 | found a handler for part 'test:debugreply' | |||
|
497 | debugreply: no reply | |||
|
498 | payload chunk size: 0 | |||
466 | part header size: 43 |
|
499 | part header size: 43 | |
467 | part type: "test:math" |
|
500 | part type: "test:math" | |
468 |
part id: " |
|
501 | part id: "4" | |
469 | part parameters: 3 |
|
502 | part parameters: 3 | |
470 | ignoring unknown advisory part 'test:math' |
|
503 | ignoring unknown advisory part 'test:math' | |
471 | payload chunk size: 2 |
|
504 | payload chunk size: 2 | |
472 | payload chunk size: 0 |
|
505 | payload chunk size: 0 | |
473 | part header size: 16 |
|
506 | part header size: 16 | |
474 | part type: "test:ping" |
|
507 | part type: "test:ping" | |
475 |
part id: " |
|
508 | part id: "5" | |
476 | part parameters: 0 |
|
509 | part parameters: 0 | |
477 | found a handler for part 'test:ping' |
|
510 | found a handler for part 'test:ping' | |
478 |
received ping request (id |
|
511 | received ping request (id 5) | |
479 | payload chunk size: 0 |
|
512 | payload chunk size: 0 | |
480 | part header size: 0 |
|
513 | part header size: 0 | |
481 | end of bundle2 stream |
|
514 | end of bundle2 stream | |
@@ -492,6 +525,7 b' Unbundle with an unknown mandatory part' | |||||
492 | Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko |
|
525 | Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko | |
493 | Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko |
|
526 | Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko | |
494 | Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko. |
|
527 | Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko. | |
|
528 | debugreply: no reply | |||
495 | 0 unread bytes |
|
529 | 0 unread bytes | |
496 | abort: missing support for 'test:unknown' |
|
530 | abort: missing support for 'test:unknown' | |
497 | [255] |
|
531 | [255] | |
@@ -510,8 +544,11 b' The reply is a bundle' | |||||
510 | Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko |
|
544 | Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko | |
511 | Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko |
|
545 | Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko | |
512 | Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko. |
|
546 | Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko. | |
513 |
\ |
|
547 | \x00\x00\x00\x00\x00\x1b\x06output\x00\x00\x00\x01\x00\x01\x0b\x01in-reply-to4\x00\x00\x00Rdebugreply: capabilities: (esc) | |
514 | replying to ping request (id 5) |
|
548 | debugreply: 'elephants' | |
|
549 | 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) | |||
|
551 | replying to ping request (id 6) | |||
515 | \x00\x00\x00\x00\x00\x00 (no-eol) (esc) |
|
552 | \x00\x00\x00\x00\x00\x00 (no-eol) (esc) | |
516 |
|
553 | |||
517 | The reply is valid |
|
554 | The reply is valid | |
@@ -522,6 +559,10 b' The reply is valid' | |||||
522 | mandatory: 0 |
|
559 | mandatory: 0 | |
523 | advisory: 1 |
|
560 | advisory: 1 | |
524 | payload: 217 bytes |
|
561 | payload: 217 bytes | |
|
562 | :output: | |||
|
563 | mandatory: 0 | |||
|
564 | advisory: 1 | |||
|
565 | payload: 82 bytes | |||
525 | :test:pong: |
|
566 | :test:pong: | |
526 | mandatory: 1 |
|
567 | mandatory: 1 | |
527 | advisory: 0 |
|
568 | advisory: 0 | |
@@ -530,7 +571,7 b' The reply is valid' | |||||
530 | mandatory: 0 |
|
571 | mandatory: 0 | |
531 | advisory: 1 |
|
572 | advisory: 1 | |
532 | payload: 61 bytes |
|
573 | payload: 61 bytes | |
533 |
parts count: |
|
574 | parts count: 4 | |
534 |
|
575 | |||
535 | Unbundle the reply to get the output: |
|
576 | Unbundle the reply to get the output: | |
536 |
|
577 | |||
@@ -539,8 +580,11 b' Unbundle the reply to get the output:' | |||||
539 | remote: Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko |
|
580 | remote: Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko | |
540 | remote: Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko |
|
581 | remote: Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko | |
541 | remote: Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko. |
|
582 | remote: Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko. | |
542 | remote: received ping request (id 5) |
|
583 | remote: debugreply: capabilities: | |
543 | remote: replying to ping request (id 5) |
|
584 | remote: debugreply: 'elephants' | |
|
585 | remote: debugreply: 'ping-pong' | |||
|
586 | remote: received ping request (id 6) | |||
|
587 | remote: replying to ping request (id 6) | |||
544 | 0 unread bytes |
|
588 | 0 unread bytes | |
545 |
|
589 | |||
546 | Support for changegroup |
|
590 | Support for changegroup |
General Comments 0
You need to be logged in to leave comments.
Login now