~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4980
4980
 
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.',
4999
 
                            type=str),
5000
 
                     Option('force',
5001
 
                        help='Perform reconfiguration even if local changes'
5002
 
                        ' will be lost.')
5003
 
                     ]
 
4983
    takes_options = [
 
4984
        RegistryOption.from_kwargs(
 
4985
            'target_type',
 
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.'
 
5001
            ),
 
5002
        Option('bind-to', help='Branch to bind checkout to.', type=str),
 
5003
        Option('force',
 
5004
               help='Perform reconfiguration even if local changes'
 
5005
               ' will be lost.')
 
5006
        ]
5004
5007
 
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,
5015
 
                                                                  bind_to)
 
5017
            reconfiguration = reconfigure.Reconfigure.to_checkout(
 
5018
                directory, bind_to)
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(
 
5028
                directory, True)
 
5029
        elif target_type == 'with-no-trees':
 
5030
            reconfiguration = reconfigure.Reconfigure.set_repository_trees(
 
5031
                directory, False)
5023
5032
        reconfiguration.apply(force)
5024
5033
 
5025
5034