4152
4153
self.outf.write('%-20s %s\n' % (tag_name, target))
4156
class cmd_reconfigure(Command):
4157
"""Reconfigure the type of a bzr directory.
4159
A target configuration must be specified.
4161
For checkouts, the bind-to location will be auto-detected if not specified.
4162
The order of preference is
4163
1. For a lightweight checkout, the current bound location.
4164
2. For branches that used to be checkouts, the previously-bound location.
4165
3. The push location.
4166
4. The parent location.
4167
If none of these is available, --bind-to must be specified.
4170
takes_args = ['location?']
4171
takes_options = [RegistryOption.from_kwargs('target_type',
4172
title='Target type',
4173
help='The type to reconfigure the directory to.',
4174
value_switches=True, enum_switch=False,
4175
branch='Reconfigure to a branch.',
4176
tree='Reconfigure to a tree.',
4177
checkout='Reconfigure to a checkout.'),
4178
Option('bind-to', help='Branch to bind checkout to.',
4181
help='Perform reconfiguration even if local changes'
4185
def run(self, location=None, target_type=None, bind_to=None, force=False):
4186
directory = bzrdir.BzrDir.open(location)
4187
if target_type is None:
4188
raise BzrCommandError('No target configuration specified')
4189
elif target_type == 'branch':
4190
reconfiguration = reconfigure.Reconfigure.to_branch(directory)
4191
elif target_type == 'tree':
4192
reconfiguration = reconfigure.Reconfigure.to_tree(directory)
4193
elif target_type == 'checkout':
4194
reconfiguration = reconfigure.Reconfigure.to_checkout(directory,
4196
reconfiguration.apply(force)
4155
4199
def _create_prefix(cur_transport):
4156
4200
needed = [cur_transport]
4157
4201
# Recurse upwards until we can create a directory successfully