1
1
# Copyright (C) 2005, 2006, 2007 Aaron Bentley <aaron@aaronbentley.com>
2
# Copyright (C) 2005, 2006 Canonical Limited.
2
# Copyright (C) 2005, 2006, 2011 Canonical Limited.
3
3
# Copyright (C) 2006 Michael Ellerman.
5
5
# This program is free software; you can redistribute it and/or modify
380
380
If --branch is specified, the branch will be deleted too, but only if the
381
381
the branch has no new commits (relative to its parent).
383
If bzr-pipeline is also installed, the --store option will store changes
384
in the branch before deleting the tree. To restore the changes, do::
386
bzr checkout --lightweight $BRANCH $CHECKOUT
387
bzr switch-pipe -d $CHECKOUT `bzr nick -d $CHECKOUT`
383
389
takes_options = [Option("branch", help="Remove associated branch from"
385
Option('force', help='Delete tree even if contents are'
391
RegistryOption('change_policy',
392
'How to handle changed files',
394
('bzrlib.plugins.bzrtools.zap',
395
'change_policy_registry'),
387
398
takes_args = ["checkout"]
388
def run(self, checkout, branch=False, force=False):
390
return zap(checkout, remove_branch=branch, allow_modified=force)
399
def run(self, checkout, branch=False, change_policy=None):
401
change_policy_registry,
405
if change_policy is None:
406
change_policy = change_policy_registry.get()
407
if change_policy is StoreChanges:
409
import bzrlib.plugins.pipeline
411
raise BzrCommandError('--store requires bzr-pipeline.')
413
raise BzrCommandError('Cannot store changes in branch, then'
415
return zap(checkout, remove_branch=branch, policy=change_policy)
393
418
class cmd_cbranch(BzrToolsCommand):