1085
1085
takes_options = ['verbose',
1086
1086
Option('new', help='Remove newly-added files.'),
1087
1087
RegistryOption.from_kwargs('file-deletion-strategy',
1088
'The file deletion mode to be used',
1088
'The file deletion mode to be used.',
1089
1089
title='Deletion Strategy', value_switches=True, enum_switch=False,
1090
1090
safe='Only delete files if they can be'
1091
1091
' safely recovered (default).',
3826
3830
Option('output', short_name='o', help='Write directive to this file.',
3833
RegistryOption.from_kwargs('format',
3834
'Use the specified output format.',
3835
**{'4': 'Bundle format 4, Merge Directive 2 (default)',
3836
'0.9': 'Bundle format 0.9, Merge Directive 1',})
3831
3839
def run(self, submit_branch=None, public_branch=None, no_bundle=False,
3832
3840
no_patch=False, revision=None, remember=False, output=None,
3834
from bzrlib.revision import ensure_null, NULL_REVISION
3841
format='4', **kwargs):
3835
3842
if output is None:
3836
3843
raise errors.BzrCommandError('File must be specified with'
3845
return self._run(submit_branch, revision, public_branch, remember,
3846
format, no_bundle, no_patch, output,
3847
kwargs.get('from', '.'))
3849
def _run(self, submit_branch, revision, public_branch, remember, format,
3850
no_bundle, no_patch, output, from_,):
3851
from bzrlib.revision import ensure_null, NULL_REVISION
3839
3853
outfile = self.outf
3841
3855
outfile = open(output, 'wb')
3843
from_ = kwargs.get('from', '.')
3844
3857
branch = Branch.open_containing(from_)[0]
3845
3858
if remember and submit_branch is None:
3846
3859
raise errors.BzrCommandError(
3884
3897
revision_id = ensure_null(revision_id)
3885
3898
if revision_id == NULL_REVISION:
3886
3899
raise errors.BzrCommandError('No revisions to submit.')
3887
directive = merge_directive.MergeDirective2.from_objects(
3888
branch.repository, revision_id, time.time(),
3889
osutils.local_time_offset(), submit_branch,
3890
public_branch=public_branch, include_patch=not no_patch,
3891
include_bundle=not no_bundle, message=None,
3892
base_revision_id=base_revision_id)
3901
directive = merge_directive.MergeDirective2.from_objects(
3902
branch.repository, revision_id, time.time(),
3903
osutils.local_time_offset(), submit_branch,
3904
public_branch=public_branch, include_patch=not no_patch,
3905
include_bundle=not no_bundle, message=None,
3906
base_revision_id=base_revision_id)
3907
elif format == '0.9':
3910
patch_type = 'bundle'
3912
raise errors.BzrCommandError('Format 0.9 does not'
3913
' permit bundle with no patch')
3919
directive = merge_directive.MergeDirective.from_objects(
3920
branch.repository, revision_id, time.time(),
3921
osutils.local_time_offset(), submit_branch,
3922
public_branch=public_branch, patch_type=patch_type,
3893
3925
outfile.writelines(directive.to_lines())
3895
3927
if output != '-':
3896
3928
outfile.close()
3931
class cmd_bundle_revisions(cmd_send):
3933
"""Create a merge-directive for submiting changes.
3935
A merge directive provides many things needed for requesting merges:
3937
* A machine-readable description of the merge to perform
3939
* An optional patch that is a preview of the changes requested
3941
* An optional bundle of revision data, so that the changes can be applied
3942
directly from the merge directive, without retrieving data from a
3945
If --no-bundle is specified, then public_branch is needed (and must be
3946
up-to-date), so that the receiver can perform the merge using the
3947
public_branch. The public_branch is always included if known, so that
3948
people can check it later.
3950
The submit branch defaults to the parent, but can be overridden. Both
3951
submit branch and public branch will be remembered if supplied.
3953
If a public_branch is known for the submit_branch, that public submit
3954
branch is used in the merge instructions. This means that a local mirror
3955
can be used as your actual submit branch, once you have set public_branch
3958
Two formats are currently supported: "4" uses revision bundle format 4 and
3959
merge directive format 2. It is significantly faster and smaller than
3960
older formats. It is compatible with Bazaar 0.19 and later. It is the
3961
default. "0.9" uses revision bundle format 0.9 and merge directive
3962
format 1. It is compatible with Bazaar 0.12 - 0.18.
3965
aliases = ['bundle']
3967
_see_also = ['send', 'merge']
3971
def run(self, submit_branch=None, public_branch=None, no_bundle=False,
3972
no_patch=False, revision=None, remember=False, output=None,
3973
format='4', **kwargs):
3976
return self._run(submit_branch, revision, public_branch, remember,
3977
format, no_bundle, no_patch, output,
3978
kwargs.get('from', '.'))
3899
3981
class cmd_tag(Command):
3900
3982
"""Create, remove or modify a tag naming a revision.