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',
1704
1705
accelerator_tree, hardlink)
1708
class cmd_clone(Command):
1709
__doc__ = """Clone a control directory.
1712
takes_args = ['from_location', 'to_location?']
1713
takes_options = ['revision',
1714
Option('no-recurse-nested',
1715
help='Do not recursively check out nested trees.'),
1718
def run(self, from_location, to_location=None, revision=None, no_recurse_nested=False):
1719
accelerator_tree, br_from = controldir.ControlDir.open_tree_or_branch(
1721
if no_recurse_nested:
1725
revision = _get_one_revision('branch', revision)
1726
self.enter_context(br_from.lock_read())
1727
if revision is not None:
1728
revision_id = revision.as_revision_id(br_from)
1730
# FIXME - wt.last_revision, fallback to branch, fall back to
1731
# None or perhaps NULL_REVISION to mean copy nothing
1733
revision_id = br_from.last_revision()
1734
if to_location is None:
1735
to_location = urlutils.derive_to_location(from_location)
1736
target_controldir = br_from.controldir.clone(to_location, revision_id=revision_id)
1737
note(gettext('Created new control directory.'))
1707
1740
class cmd_renames(Command):
1708
1741
__doc__ = """Show list of renamed files.