2290
2296
takes_args = ['testspecs*']
2291
2297
takes_options = ['verbose',
2292
2298
Option('one', help='stop when one test fails'),
2293
Option('keep-output',
2299
Option('keep-output',
2294
2300
help='keep output directories when tests fail'),
2296
2302
help='Use a different transport by default '
2297
2303
'throughout the test suite.',
2298
2304
type=get_transport_type),
2299
Option('benchmark', help='run the bzr bencharks.'),
2305
Option('benchmark', help='run the bzr benchmarks.'),
2300
2306
Option('lsprof-timed',
2301
2307
help='generate lsprof output for benchmarked'
2302
2308
' sections of code.'),
3240
3246
class cmd_join(Command):
3241
3247
"""Combine a subtree into its containing tree.
3243
This is marked as a merge of the subtree into the containing tree, and all
3244
history is preserved.
3249
This command is for experimental use only. It requires the target tree
3250
to be in dirstate-with-subtree format, which cannot be converted into
3253
The TREE argument should be an independent tree, inside another tree, but
3254
not part of it. (Such trees can be produced by "bzr split", but also by
3255
running "bzr branch" with the target inside a tree.)
3257
The result is a combined tree, with the subtree no longer an independant
3258
part. This is marked as a merge of the subtree into the containing tree,
3259
and all history is preserved.
3261
If --reference is specified, the subtree retains its independence. It can
3262
be branched by itself, and can be part of multiple projects at the same
3263
time. But operations performed in the containing tree, such as commit
3264
and merge, will recurse into the subtree.
3247
3267
takes_args = ['tree']
3248
3268
takes_options = [Option('reference', 'join by reference')]
3250
3271
def run(self, tree, reference=False):
3251
3272
sub_tree = WorkingTree.open(tree)
3276
3297
class cmd_split(Command):
3277
3298
"""Split a tree into two trees.
3300
This command is for experimental use only. It requires the target tree
3301
to be in dirstate-with-subtree format, which cannot be converted into
3304
The TREE argument should be a subdirectory of a working tree. That
3305
subdirectory will be converted into an independent tree, with its own
3306
branch. Commits in the top-level tree will not apply to the new subtree.
3307
If you want that behavior, do "bzr join --reference TREE".
3309
To undo this operation, do "bzr join TREE".
3280
3312
takes_args = ['tree']
3282
3316
def run(self, tree):
3283
3317
containing_tree, subdir = WorkingTree.open_containing(tree)
3284
3318
sub_id = containing_tree.path2id(subdir)
3328
class cmd_merge_directive(Command):
3329
"""Generate a merge directive for auto-merge tools.
3331
A directive requests a merge to be performed, and also provides all the
3332
information necessary to do so. This means it must either include a
3333
revision bundle, or the location of a branch containing the desired
3336
A submit branch (the location to merge into) must be supplied the first
3337
time the command is issued. After it has been supplied once, it will
3338
be remembered as the default.
3340
A public branch is optional if a revision bundle is supplied, but required
3341
if --diff or --plain is specified. It will be remembered as the default
3342
after the first use.
3345
takes_args = ['submit_branch?', 'public_branch?']
3348
RegistryOption.from_kwargs('patch-type',
3349
'The type of patch to include in the directive',
3350
title='Patch type', value_switches=True, enum_switch=False,
3351
bundle='Bazaar revision bundle (default)',
3352
diff='Normal unified diff',
3353
plain='No patch, just directive'),
3354
Option('sign', help='GPG-sign the directive'), 'revision',
3355
Option('mail-to', type=str,
3356
help='Instead of printing the directive, email to this address'),
3357
Option('message', type=str, short_name='m',
3358
help='Message to use when committing this merge')
3361
def run(self, submit_branch=None, public_branch=None, patch_type='bundle',
3362
sign=False, revision=None, mail_to=None, message=None):
3363
if patch_type == 'plain':
3365
branch = Branch.open('.')
3366
stored_submit_branch = branch.get_submit_branch()
3367
if submit_branch is None:
3368
submit_branch = stored_submit_branch
3370
if stored_submit_branch is None:
3371
branch.set_submit_branch(submit_branch)
3372
if submit_branch is None:
3373
submit_branch = branch.get_parent()
3374
if submit_branch is None:
3375
raise errors.BzrCommandError('No submit branch specified or known')
3377
stored_public_branch = branch.get_public_branch()
3378
if public_branch is None:
3379
public_branch = stored_public_branch
3380
elif stored_public_branch is None:
3381
branch.set_public_branch(public_branch)
3382
if patch_type != "bundle" and public_branch is None:
3383
raise errors.BzrCommandError('No public branch specified or'
3385
if revision is not None:
3386
if len(revision) != 1:
3387
raise errors.BzrCommandError('bzr merge-directive takes '
3388
'exactly one revision identifier')
3390
revision_id = revision[0].in_history(branch).rev_id
3392
revision_id = branch.last_revision()
3393
directive = merge_directive.MergeDirective.from_objects(
3394
branch.repository, revision_id, time.time(),
3395
osutils.local_time_offset(), submit_branch,
3396
public_branch=public_branch, patch_type=patch_type,
3400
self.outf.write(directive.to_signed(branch))
3402
self.outf.writelines(directive.to_lines())
3404
message = directive.to_email(mail_to, branch, sign)
3406
server = branch.get_config().get_user_option('smtp_server')
3408
server = 'localhost'
3410
s.sendmail(message['From'], message['To'], message.as_string())
3294
3413
class cmd_tag(Command):
3295
3414
"""Create a tag naming a revision.