/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-06-15 01:29:36 UTC
  • mfrom: (7490.40.4 work)
  • mto: (7490.40.19 work)
  • mto: This revision was merged to the branch mainline in revision 7516.
  • Revision ID: jelmer@jelmer.uk-20200615012936-1adqbu592y7lzmy8
Merge upstream.

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',
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.'),
1472
1475
                     ]
1473
1476
 
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(
1480
 
            from_location)
 
1483
            from_location, name=colocated_branch)
1481
1484
        if no_recurse_nested:
1482
1485
            recurse = 'none'
1483
1486
        else:
1704
1707
                               accelerator_tree, hardlink)
1705
1708
 
1706
1709
 
 
1710
class cmd_clone(Command):
 
1711
    __doc__ = """Clone a control directory.
 
1712
    """
 
1713
 
 
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.'),
 
1718
                     ]
 
1719
 
 
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(
 
1722
            from_location)
 
1723
        if no_recurse_nested:
 
1724
            recurse = 'none'
 
1725
        else:
 
1726
            recurse = 'down'
 
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)
 
1731
        else:
 
1732
            # FIXME - wt.last_revision, fallback to branch, fall back to
 
1733
            # None or perhaps NULL_REVISION to mean copy nothing
 
1734
            # RBC 20060209
 
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.'))
 
1740
 
 
1741
 
1707
1742
class cmd_renames(Command):
1708
1743
    __doc__ = """Show list of renamed files.
1709
1744
    """
4198
4233
 
4199
4234
        try:
4200
4235
            from . import tests
4201
 
        except ImportError:
 
4236
        except ImportError as e:
4202
4237
            raise errors.BzrCommandError("tests not available. Install the "
4203
4238
                                         "breezy tests to run the breezy testsuite.")
4204
4239