4981
4981
_see_also = ['branches', 'checkouts', 'standalone-trees', 'working-trees']
4982
4982
takes_args = ['location?']
4983
takes_options = [RegistryOption.from_kwargs('target_type',
4984
title='Target type',
4985
help='The type to reconfigure the directory to.',
4986
value_switches=True, enum_switch=False,
4987
branch='Reconfigure to be an unbound branch '
4988
'with no working tree.',
4989
tree='Reconfigure to be an unbound branch '
4990
'with a working tree.',
4991
checkout='Reconfigure to be a bound branch '
4992
'with a working tree.',
4993
lightweight_checkout='Reconfigure to be a lightweight'
4994
' checkout (with no local history).',
4995
standalone='Reconfigure to be a standalone branch '
4996
'(i.e. stop using shared repository).',
4997
use_shared='Reconfigure to use a shared repository.'),
4998
Option('bind-to', help='Branch to bind checkout to.',
5001
help='Perform reconfiguration even if local changes'
4984
RegistryOption.from_kwargs(
4986
title='Target type',
4987
help='The type to reconfigure the directory to.',
4988
value_switches=True, enum_switch=False,
4989
branch='Reconfigure to be an unbound branch with no working tree.',
4990
tree='Reconfigure to be an unbound branch with a working tree.',
4991
checkout='Reconfigure to be a bound branch with a working tree.',
4992
lightweight_checkout='Reconfigure to be a lightweight'
4993
' checkout (with no local history).',
4994
standalone='Reconfigure to be a standalone branch '
4995
'(i.e. stop using shared repository).',
4996
use_shared='Reconfigure to use a shared repository.',
4997
with_trees='Reconfigure repository to create '
4998
'working trees on branches by default.',
4999
with_no_trees='Reconfigure repository to not create '
5000
'working trees on branches by default.'
5002
Option('bind-to', help='Branch to bind checkout to.', type=str),
5004
help='Perform reconfiguration even if local changes'
5005
5008
def run(self, location=None, target_type=None, bind_to=None, force=False):
5006
5009
directory = bzrdir.BzrDir.open(location)
5011
5014
elif target_type == 'tree':
5012
5015
reconfiguration = reconfigure.Reconfigure.to_tree(directory)
5013
5016
elif target_type == 'checkout':
5014
reconfiguration = reconfigure.Reconfigure.to_checkout(directory,
5017
reconfiguration = reconfigure.Reconfigure.to_checkout(
5016
5019
elif target_type == 'lightweight-checkout':
5017
5020
reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
5018
5021
directory, bind_to)
5020
5023
reconfiguration = reconfigure.Reconfigure.to_use_shared(directory)
5021
5024
elif target_type == 'standalone':
5022
5025
reconfiguration = reconfigure.Reconfigure.to_standalone(directory)
5026
elif target_type == 'with-trees':
5027
reconfiguration = reconfigure.Reconfigure.set_repository_trees(
5029
elif target_type == 'with-no-trees':
5030
reconfiguration = reconfigure.Reconfigure.set_repository_trees(
5023
5032
reconfiguration.apply(force)