1434
1434
parameter, as in "branch foo/bar -r 5".
1437
1438
_see_also = ['checkout']
1438
1439
takes_args = ['from_location', 'to_location?']
1439
1440
takes_options = ['revision',
1461
1462
help="Bind new branch to from location."),
1462
1463
Option('no-recurse-nested',
1463
1464
help='Do not recursively check out nested trees.'),
1465
Option('colocated-branch', short_name='b',
1466
type=str, help='Name of colocated branch to sprout.'),
1466
1469
def run(self, from_location, to_location=None, revision=None,
1467
1470
hardlink=False, stacked=False, standalone=False, no_tree=False,
1468
1471
use_existing_dir=False, switch=False, bind=False,
1469
files_from=None, no_recurse_nested=False):
1472
files_from=None, no_recurse_nested=False, colocated_branch=None):
1470
1473
from breezy import switch as _mod_switch
1471
1474
accelerator_tree, br_from = controldir.ControlDir.open_tree_or_branch(
1475
from_location, name=colocated_branch)
1473
1476
if no_recurse_nested:
1474
1477
recurse = 'none'
1695
1698
accelerator_tree, hardlink)
1701
class cmd_clone(Command):
1702
__doc__ = """Clone a control directory.
1705
takes_args = ['from_location', 'to_location?']
1706
takes_options = ['revision',
1707
Option('no-recurse-nested',
1708
help='Do not recursively check out nested trees.'),
1711
def run(self, from_location, to_location=None, revision=None, no_recurse_nested=False):
1712
accelerator_tree, br_from = controldir.ControlDir.open_tree_or_branch(
1714
if no_recurse_nested:
1718
revision = _get_one_revision('branch', revision)
1719
self.enter_context(br_from.lock_read())
1720
if revision is not None:
1721
revision_id = revision.as_revision_id(br_from)
1723
# FIXME - wt.last_revision, fallback to branch, fall back to
1724
# None or perhaps NULL_REVISION to mean copy nothing
1726
revision_id = br_from.last_revision()
1727
if to_location is None:
1728
to_location = urlutils.derive_to_location(from_location)
1729
target_controldir = br_from.controldir.clone(to_location, revision_id=revision_id)
1730
note(gettext('Created new control directory.'))
1698
1733
class cmd_renames(Command):
1699
1734
__doc__ = """Show list of renamed files.