~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-03-11 13:47:06 UTC
  • mfrom: (5051.3.16 use-branch-open)
  • Revision ID: pqm@pqm.ubuntu.com-20100311134706-kaerqhx3lf7xn6rh
(Jelmer) Pass colocated branch names further down the call stack.

Show diffs side-by-side

added added

removed removed

Lines of Context:
715
715
        """
716
716
        return None
717
717
 
718
 
    def get_branch_transport(self, branch_format):
 
718
    def get_branch_transport(self, branch_format, name=None):
719
719
        """Get the transport for use by branch format in this BzrDir.
720
720
 
721
721
        Note that bzr dirs that do not support format strings will raise
1383
1383
 
1384
1384
    def create_branch(self, name=None):
1385
1385
        """See BzrDir.create_branch."""
1386
 
        if name is not None:
1387
 
            raise errors.NoColocatedBranchSupport(self)
1388
 
        return self._format.get_branch_format().initialize(self)
 
1386
        return self._format.get_branch_format().initialize(self, name=name)
1389
1387
 
1390
1388
    def destroy_branch(self, name=None):
1391
1389
        """See BzrDir.destroy_branch."""
1449
1447
        raise errors.UnsupportedOperation(self.destroy_workingtree_metadata,
1450
1448
                                          self)
1451
1449
 
1452
 
    def get_branch_transport(self, branch_format):
 
1450
    def get_branch_transport(self, branch_format, name=None):
1453
1451
        """See BzrDir.get_branch_transport()."""
 
1452
        if name is not None:
 
1453
            raise errors.NoColocatedBranchSupport(self)
1454
1454
        if branch_format is None:
1455
1455
            return self.transport
1456
1456
        try:
1492
1492
    def open_branch(self, name=None, unsupported=False,
1493
1493
                    ignore_fallbacks=False):
1494
1494
        """See BzrDir.open_branch."""
1495
 
        if name is not None:
1496
 
            raise errors.NoColocatedBranchSupport(self)
1497
1495
        from bzrlib.branch import BzrBranchFormat4
1498
1496
        format = BzrBranchFormat4()
1499
1497
        self._check_supported(format, unsupported)
1500
 
        return format.open(self, _found=True)
 
1498
        return format.open(self, name, _found=True)
1501
1499
 
1502
1500
    def sprout(self, url, revision_id=None, force_new_repo=False,
1503
1501
               possible_transports=None, accelerator_tree=None,
1622
1620
 
1623
1621
    def create_branch(self, name=None):
1624
1622
        """See BzrDir.create_branch."""
1625
 
        if name is not None:
1626
 
            raise errors.NoColocatedBranchSupport(self)
1627
 
        return self._format.get_branch_format().initialize(self)
 
1623
        return self._format.get_branch_format().initialize(self, name=name)
1628
1624
 
1629
1625
    def destroy_branch(self, name=None):
1630
1626
        """See BzrDir.create_branch."""
1678
1674
        format = BranchFormat.find_format(self)
1679
1675
        return format.get_reference(self)
1680
1676
 
1681
 
    def get_branch_transport(self, branch_format):
 
1677
    def get_branch_transport(self, branch_format, name=None):
1682
1678
        """See BzrDir.get_branch_transport()."""
 
1679
        if name is not None:
 
1680
            raise errors.NoColocatedBranchSupport(self)
1683
1681
        # XXX: this shouldn't implicitly create the directory if it's just
1684
1682
        # promising to get a transport -- mbp 20090727
1685
1683
        if branch_format is None:
1774
1772
    def open_branch(self, name=None, unsupported=False,
1775
1773
                    ignore_fallbacks=False):
1776
1774
        """See BzrDir.open_branch."""
1777
 
        if name is not None:
1778
 
            raise errors.NoColocatedBranchSupport(self)
1779
1775
        format = self.find_branch_format()
1780
1776
        self._check_supported(format, unsupported)
1781
 
        return format.open(self, _found=True, ignore_fallbacks=ignore_fallbacks)
 
1777
        return format.open(self, name=name,
 
1778
            _found=True, ignore_fallbacks=ignore_fallbacks)
1782
1779
 
1783
1780
    def open_repository(self, unsupported=False):
1784
1781
        """See BzrDir.open_repository."""