/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

  • Committer: Jelmer Vernooij
  • Date: 2020-05-06 02:13:25 UTC
  • mfrom: (7490.7.21 work)
  • mto: This revision was merged to the branch mainline in revision 7501.
  • Revision ID: jelmer@jelmer.uk-20200506021325-awbmmqu1zyorz7sj
Merge 3.1 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1434
1434
    parameter, as in "branch foo/bar -r 5".
1435
1435
    """
1436
1436
 
 
1437
    aliase = ['sprout']
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.'),
1464
1467
                     ]
1465
1468
 
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(
1472
 
            from_location)
 
1475
            from_location, name=colocated_branch)
1473
1476
        if no_recurse_nested:
1474
1477
            recurse = 'none'
1475
1478
        else:
1695
1698
                               accelerator_tree, hardlink)
1696
1699
 
1697
1700
 
 
1701
class cmd_clone(Command):
 
1702
    __doc__ = """Clone a control directory.
 
1703
    """
 
1704
 
 
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.'),
 
1709
                     ]
 
1710
 
 
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(
 
1713
            from_location)
 
1714
        if no_recurse_nested:
 
1715
            recurse = 'none'
 
1716
        else:
 
1717
            recurse = 'down'
 
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)
 
1722
        else:
 
1723
            # FIXME - wt.last_revision, fallback to branch, fall back to
 
1724
            # None or perhaps NULL_REVISION to mean copy nothing
 
1725
            # RBC 20060209
 
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.'))
 
1731
 
 
1732
 
1698
1733
class cmd_renames(Command):
1699
1734
    __doc__ = """Show list of renamed files.
1700
1735
    """