comparison mercurial/commands.py @ 6570:626cb86a6523

add compression type type parameter to bundle command
author Benoit Allard <benoit@aeteurope.nl>
date Thu, 24 Apr 2008 17:16:02 +0200
parents 92ccccb55ba3
children f242d3684f83
comparison
equal deleted inserted replaced
6569:c15bfe9cdcd6 6570:626cb86a6523
404 found in the other repository. 404 found in the other repository.
405 405
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.
413 This is useful when direct push and pull are not available or when 414 This is useful when direct push and pull are not available or when
414 exporting an entire repository is undesirable. 415 exporting an entire repository is undesirable.
458 459
459 if revs: 460 if revs:
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
467 475
468 Print the specified files as they were at the given revision. 476 Print the specified files as they were at the given revision.
2983 _('run even when remote repository is unrelated')), 2991 _('run even when remote repository is unrelated')),
2984 ('r', 'rev', [], 2992 ('r', 'rev', [],
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":
2993 (cat, 3001 (cat,
2994 [('o', 'output', '', _('print output to file with formatted name')), 3002 [('o', 'output', '', _('print output to file with formatted name')),