~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Jelmer Vernooij
  • Date: 2010-08-21 20:59:09 UTC
  • mto: This revision was merged to the branch mainline in revision 5389.
  • Revision ID: jelmer@samba.org-20100821205909-gd8k5aky4di3iing
Put _get_tree_branch onto ControlDir.

Show diffs side-by-side

added added

removed removed

Lines of Context:
815
815
                raise errors.NotBranchError(path=url)
816
816
            a_transport = new_t
817
817
 
818
 
    def _get_tree_branch(self, name=None):
819
 
        """Return the branch and tree, if any, for this bzrdir.
820
 
 
821
 
        :param name: Name of colocated branch to open.
822
 
 
823
 
        Return None for tree if not present or inaccessible.
824
 
        Raise NotBranchError if no branch is present.
825
 
        :return: (tree, branch)
826
 
        """
827
 
        try:
828
 
            tree = self.open_workingtree()
829
 
        except (errors.NoWorkingTree, errors.NotLocalUrl):
830
 
            tree = None
831
 
            branch = self.open_branch(name=name)
832
 
        else:
833
 
            if name is not None:
834
 
                branch = self.open_branch(name=name)
835
 
            else:
836
 
                branch = tree.branch
837
 
        return tree, branch
838
 
 
839
818
    @classmethod
840
819
    def open_tree_or_branch(klass, location):
841
820
        """Return the branch and working tree at a location.