Show More
@@ -0,0 +1,41 b'' | |||||
|
1 | #!/bin/sh | |||
|
2 | ||||
|
3 | echo % bundle w/o type option | |||
|
4 | hg init t1 | |||
|
5 | hg init t2 | |||
|
6 | cd t1 | |||
|
7 | echo blablablablabla > file.txt | |||
|
8 | hg ci -Ama | |||
|
9 | hg log | grep summary | |||
|
10 | hg bundle ../b1 ../t2 | |||
|
11 | ||||
|
12 | cd ../t2 | |||
|
13 | hg pull ../b1 | |||
|
14 | hg up | |||
|
15 | hg log | grep summary | |||
|
16 | cd .. | |||
|
17 | ||||
|
18 | for t in "None" "bzip2" "gzip"; do | |||
|
19 | echo % test bundle type $t | |||
|
20 | hg init t$t | |||
|
21 | cd t1 | |||
|
22 | hg bundle -t $t ../b$t ../t$t | |||
|
23 | head -c 6 ../b$t | |||
|
24 | cd ../t$t | |||
|
25 | hg pull ../b$t | |||
|
26 | hg up | |||
|
27 | hg log | grep summary | |||
|
28 | cd .. | |||
|
29 | done | |||
|
30 | ||||
|
31 | echo % test garbage file | |||
|
32 | echo garbage > bgarbage | |||
|
33 | hg init tgarbage | |||
|
34 | cd tgarbage | |||
|
35 | hg pull ../bgarbage | |||
|
36 | cd .. | |||
|
37 | ||||
|
38 | echo % test invalid bundle type | |||
|
39 | cd t1 | |||
|
40 | hg bundle -a -t garbage ../bgarbage | |||
|
41 | cd .. |
@@ -0,0 +1,55 b'' | |||||
|
1 | % bundle w/o type option | |||
|
2 | adding file.txt | |||
|
3 | summary: a | |||
|
4 | searching for changes | |||
|
5 | 1 changesets found | |||
|
6 | pulling from ../b1 | |||
|
7 | requesting all changes | |||
|
8 | adding changesets | |||
|
9 | adding manifests | |||
|
10 | adding file changes | |||
|
11 | added 1 changesets with 1 changes to 1 files | |||
|
12 | (run 'hg update' to get a working copy) | |||
|
13 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
14 | summary: a | |||
|
15 | % test bundle type None | |||
|
16 | searching for changes | |||
|
17 | 1 changesets found | |||
|
18 | HG10UNpulling from ../bNone | |||
|
19 | requesting all changes | |||
|
20 | adding changesets | |||
|
21 | adding manifests | |||
|
22 | adding file changes | |||
|
23 | added 1 changesets with 1 changes to 1 files | |||
|
24 | (run 'hg update' to get a working copy) | |||
|
25 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
26 | summary: a | |||
|
27 | % test bundle type bzip2 | |||
|
28 | searching for changes | |||
|
29 | 1 changesets found | |||
|
30 | HG10BZpulling from ../bbzip2 | |||
|
31 | requesting all changes | |||
|
32 | adding changesets | |||
|
33 | adding manifests | |||
|
34 | adding file changes | |||
|
35 | added 1 changesets with 1 changes to 1 files | |||
|
36 | (run 'hg update' to get a working copy) | |||
|
37 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
38 | summary: a | |||
|
39 | % test bundle type gzip | |||
|
40 | searching for changes | |||
|
41 | 1 changesets found | |||
|
42 | HG10GZpulling from ../bgzip | |||
|
43 | requesting all changes | |||
|
44 | adding changesets | |||
|
45 | adding manifests | |||
|
46 | adding file changes | |||
|
47 | added 1 changesets with 1 changes to 1 files | |||
|
48 | (run 'hg update' to get a working copy) | |||
|
49 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
50 | summary: a | |||
|
51 | % test garbage file | |||
|
52 | abort: ../bgarbage: not a Mercurial bundle file | |||
|
53 | % test invalid bundle type | |||
|
54 | 1 changesets found | |||
|
55 | abort: unknown bundle type specified with --type |
@@ -406,7 +406,8 b' def bundle(ui, repo, fname, dest=None, *' | |||||
406 | If no destination repository is specified the destination is |
|
406 | If no destination repository is specified the destination is | |
407 | assumed to have all the nodes specified by one or more --base |
|
407 | assumed to have all the nodes specified by one or more --base | |
408 | parameters. To create a bundle containing all changesets, use |
|
408 | parameters. To create a bundle containing all changesets, use | |
409 | --all (or --base null). |
|
409 | --all (or --base null). To change the compression method applied, | |
|
410 | use the -t option (by default, bundles are compressed using bz2). | |||
410 |
|
411 | |||
411 | The bundle file can then be transferred using conventional means and |
|
412 | The bundle file can then be transferred using conventional means and | |
412 | applied to another repository with the unbundle or pull command. |
|
413 | applied to another repository with the unbundle or pull command. | |
@@ -460,7 +461,14 b' def bundle(ui, repo, fname, dest=None, *' | |||||
460 | cg = repo.changegroupsubset(o, revs, 'bundle') |
|
461 | cg = repo.changegroupsubset(o, revs, 'bundle') | |
461 | else: |
|
462 | else: | |
462 | cg = repo.changegroup(o, 'bundle') |
|
463 | cg = repo.changegroup(o, 'bundle') | |
463 | changegroup.writebundle(cg, fname, "HG10BZ") |
|
464 | ||
|
465 | bundletype = opts.get('type', 'bzip2').lower() | |||
|
466 | btypes = {'none': 'HG10UN', 'bzip2': 'HG10BZ', 'gzip': 'HG10GZ'} | |||
|
467 | bundletype = btypes.get(bundletype) | |||
|
468 | if bundletype not in changegroup.bundletypes: | |||
|
469 | raise util.Abort(_('unknown bundle type specified with --type')) | |||
|
470 | ||||
|
471 | changegroup.writebundle(cg, fname, bundletype) | |||
464 |
|
472 | |||
465 | def cat(ui, repo, file1, *pats, **opts): |
|
473 | def cat(ui, repo, file1, *pats, **opts): | |
466 | """output the current or given revision of files |
|
474 | """output the current or given revision of files | |
@@ -2985,8 +2993,8 b' table = {' | |||||
2985 | _('a changeset up to which you would like to bundle')), |
|
2993 | _('a changeset up to which you would like to bundle')), | |
2986 | ('', 'base', [], |
|
2994 | ('', 'base', [], | |
2987 | _('a base changeset to specify instead of a destination')), |
|
2995 | _('a base changeset to specify instead of a destination')), | |
2988 | ('a', 'all', None, |
|
2996 | ('a', 'all', None, _('bundle all changesets in the repository')), | |
2989 | _('bundle all changesets in the repository')), |
|
2997 | ('t', 'type', 'bzip2', _('bundle compression type to use')), | |
2990 | ] + remoteopts, |
|
2998 | ] + remoteopts, | |
2991 | _('hg bundle [-f] [-a] [-r REV]... [--base REV]... FILE [DEST]')), |
|
2999 | _('hg bundle [-f] [-a] [-r REV]... [--base REV]... FILE [DEST]')), | |
2992 | "cat": |
|
3000 | "cat": |
General Comments 0
You need to be logged in to leave comments.
Login now