27 > for line in part.data.split('\n'): |
27 > for line in part.data.split('\n'): |
28 > repo.ui.write(' %s\n' % line) |
28 > repo.ui.write(' %s\n' % line) |
29 > |
29 > |
30 > @command('bundle2', |
30 > @command('bundle2', |
31 > [('', 'param', [], 'stream level parameter'), |
31 > [('', 'param', [], 'stream level parameter'), |
|
32 > ('', 'unknown', False, 'include an unknown mandatory part in the bundle'), |
32 > ('', 'parts', False, 'include some arbitrary parts to the bundle'),], |
33 > ('', 'parts', False, 'include some arbitrary parts to the bundle'),], |
33 > '[OUTPUTFILE]') |
34 > '[OUTPUTFILE]') |
34 > def cmdbundle2(ui, repo, path=None, **opts): |
35 > def cmdbundle2(ui, repo, path=None, **opts): |
35 > """write a bundle2 container on standard ouput""" |
36 > """write a bundle2 container on standard ouput""" |
36 > bundler = bundle2.bundle20(ui) |
37 > bundler = bundle2.bundle20(ui) |
52 > part = bundle2.part('test:math', |
53 > part = bundle2.part('test:math', |
53 > [('pi', '3.14'), ('e', '2.72')], |
54 > [('pi', '3.14'), ('e', '2.72')], |
54 > [('cooking', 'raw')], |
55 > [('cooking', 'raw')], |
55 > '42') |
56 > '42') |
56 > bundler.addpart(part) |
57 > bundler.addpart(part) |
|
58 > if opts['unknown']: |
|
59 > part = bundle2.part('test:UNKNOWN', |
|
60 > data='some random content') |
|
61 > bundler.addpart(part) |
57 > |
62 > |
58 > if path is None: |
63 > if path is None: |
59 > file = sys.stdout |
64 > file = sys.stdout |
60 > else: |
65 > else: |
61 > file = open(path, 'w') |
66 > file = open(path, 'w') |
64 > file.write(chunk) |
69 > file.write(chunk) |
65 > |
70 > |
66 > @command('unbundle2', [], '') |
71 > @command('unbundle2', [], '') |
67 > def cmdunbundle2(ui, repo): |
72 > def cmdunbundle2(ui, repo): |
68 > """process a bundle2 stream from stdin on the current repo""" |
73 > """process a bundle2 stream from stdin on the current repo""" |
69 > bundle2.processbundle(repo, sys.stdin) |
74 > try: |
|
75 > bundle2.processbundle(repo, sys.stdin) |
|
76 > except KeyError, exc: |
|
77 > raise util.Abort('missing support for %s' % exc) |
70 > |
78 > |
71 > @command('statbundle2', [], '') |
79 > @command('statbundle2', [], '') |
72 > def cmdstatbundle2(ui, repo): |
80 > def cmdstatbundle2(ui, repo): |
73 > """print statistic on the bundle2 container read from stdin""" |
81 > """print statistic on the bundle2 container read from stdin""" |
74 > unbundler = bundle2.unbundle20(ui, sys.stdin) |
82 > unbundler = bundle2.unbundle20(ui, sys.stdin) |
375 payload chunk size: 2 |
383 payload chunk size: 2 |
376 payload chunk size: 0 |
384 payload chunk size: 0 |
377 ignoring unknown advisory part 'test:math' |
385 ignoring unknown advisory part 'test:math' |
378 part header size: 0 |
386 part header size: 0 |
379 end of bundle2 stream |
387 end of bundle2 stream |
|
388 |
|
389 |
|
390 $ hg bundle2 --parts --unknown ../unknown.hg2 |
|
391 |
|
392 $ hg unbundle2 < ../unknown.hg2 |
|
393 The choir start singing: |
|
394 Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko |
|
395 Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko |
|
396 Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko. |
|
397 abort: missing support for 'test:unknown' |
|
398 [255] |