/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/builtins.py

Add a 'brz clone' command.

Merged from https://code.launchpad.net/~jelmer/brz/clone/+merge/379369

Show diffs side-by-side

added added

removed removed

Lines of Context:
1442
1442
    parameter, as in "branch foo/bar -r 5".
1443
1443
    """
1444
1444
 
 
1445
    aliase = ['sprout']
1445
1446
    _see_also = ['checkout']
1446
1447
    takes_args = ['from_location', 'to_location?']
1447
1448
    takes_options = ['revision',
1704
1705
                               accelerator_tree, hardlink)
1705
1706
 
1706
1707
 
 
1708
class cmd_clone(Command):
 
1709
    __doc__ = """Clone a control directory.
 
1710
    """
 
1711
 
 
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.'),
 
1716
                     ]
 
1717
 
 
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(
 
1720
            from_location)
 
1721
        if no_recurse_nested:
 
1722
            recurse = 'none'
 
1723
        else:
 
1724
            recurse = 'down'
 
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)
 
1729
        else:
 
1730
            # FIXME - wt.last_revision, fallback to branch, fall back to
 
1731
            # None or perhaps NULL_REVISION to mean copy nothing
 
1732
            # RBC 20060209
 
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.'))
 
1738
 
 
1739
 
1707
1740
class cmd_renames(Command):
1708
1741
    __doc__ = """Show list of renamed files.
1709
1742
    """