1442
1442
parameter, as in "branch foo/bar -r 5".
1445
1446
_see_also = ['checkout']
1446
1447
takes_args = ['from_location', 'to_location?']
1447
1448
takes_options = ['revision',
1469
1470
help="Bind new branch to from location."),
1470
1471
Option('no-recurse-nested',
1471
1472
help='Do not recursively check out nested trees.'),
1473
Option('colocated-branch', short_name='b',
1474
type=str, help='Name of colocated branch to sprout.'),
1474
1477
def run(self, from_location, to_location=None, revision=None,
1475
1478
hardlink=False, stacked=False, standalone=False, no_tree=False,
1476
1479
use_existing_dir=False, switch=False, bind=False,
1477
files_from=None, no_recurse_nested=False):
1480
files_from=None, no_recurse_nested=False, colocated_branch=None):
1478
1481
from breezy import switch as _mod_switch
1479
1482
accelerator_tree, br_from = controldir.ControlDir.open_tree_or_branch(
1483
from_location, name=colocated_branch)
1481
1484
if no_recurse_nested:
1482
1485
recurse = 'none'
1704
1707
accelerator_tree, hardlink)
1710
class cmd_clone(Command):
1711
__doc__ = """Clone a control directory.
1714
takes_args = ['from_location', 'to_location?']
1715
takes_options = ['revision',
1716
Option('no-recurse-nested',
1717
help='Do not recursively check out nested trees.'),
1720
def run(self, from_location, to_location=None, revision=None, no_recurse_nested=False):
1721
accelerator_tree, br_from = controldir.ControlDir.open_tree_or_branch(
1723
if no_recurse_nested:
1727
revision = _get_one_revision('branch', revision)
1728
self.enter_context(br_from.lock_read())
1729
if revision is not None:
1730
revision_id = revision.as_revision_id(br_from)
1732
# FIXME - wt.last_revision, fallback to branch, fall back to
1733
# None or perhaps NULL_REVISION to mean copy nothing
1735
revision_id = br_from.last_revision()
1736
if to_location is None:
1737
to_location = urlutils.derive_to_location(from_location)
1738
target_controldir = br_from.controldir.clone(to_location, revision_id=revision_id)
1739
note(gettext('Created new control directory.'))
1707
1742
class cmd_renames(Command):
1708
1743
__doc__ = """Show list of renamed files.