12 > from mercurial import cmdutil |
12 > from mercurial import cmdutil |
13 > from mercurial import bundle2 |
13 > from mercurial import bundle2 |
14 > cmdtable = {} |
14 > cmdtable = {} |
15 > command = cmdutil.command(cmdtable) |
15 > command = cmdutil.command(cmdtable) |
16 > |
16 > |
17 > @command('bundle2', [], '') |
17 > @command('bundle2', |
18 > def cmdbundle2(ui, repo): |
18 > [('', 'param', [], 'stream level parameter'),], |
|
19 > '') |
|
20 > def cmdbundle2(ui, repo, **opts): |
19 > """write a bundle2 container on standard ouput""" |
21 > """write a bundle2 container on standard ouput""" |
20 > bundle = bundle2.bundle20() |
22 > bundler = bundle2.bundle20() |
21 > for chunk in bundle.getchunks(): |
23 > for p in opts['param']: |
|
24 > bundler.addparam(p) |
|
25 > for chunk in bundler.getchunks(): |
22 > ui.write(chunk) |
26 > ui.write(chunk) |
23 > |
27 > |
24 > @command('unbundle2', [], '') |
28 > @command('unbundle2', [], '') |
25 > def cmdunbundle2(ui, repo): |
29 > def cmdunbundle2(ui, repo): |
26 > """read a bundle2 container from standard input""" |
30 > """read a bundle2 container from standard input""" |
58 $ hg bundle --all ../bundle.hg |
69 $ hg bundle --all ../bundle.hg |
59 1 changesets found |
70 1 changesets found |
60 $ hg unbundle2 < ../bundle.hg |
71 $ hg unbundle2 < ../bundle.hg |
61 abort: unknown bundle version 10 |
72 abort: unknown bundle version 10 |
62 [255] |
73 [255] |
|
74 |
|
75 Test parameters |
|
76 ================= |
|
77 |
|
78 - some options |
|
79 - no parts |
|
80 |
|
81 advisory parameters, no value |
|
82 ------------------------------- |
|
83 |
|
84 Simplest possible parameters form |
|
85 |
|
86 Test generation |
|
87 |
|
88 $ hg bundle2 --param 'caution' |
|
89 HG20\x00\x07caution\x00\x00 (no-eol) (esc) |
|
90 |
|
91 Test generation multiple option |
|
92 |
|
93 $ hg bundle2 --param 'caution' --param 'meal' |
|
94 HG20\x00\x0ccaution meal\x00\x00 (no-eol) (esc) |