844
845
tree, branch = bzrdir._get_tree_branch()
845
846
return tree, branch, relpath
849
def open_containing_tree_branch_or_repository(klass, location):
850
"""Return the working tree, branch and repo contained by a location.
852
Returns (tree, branch, repository, relpath).
853
If there is no tree containing the location, tree will be None.
854
If there is no branch containing the location, branch will be None.
855
If there is no repository containing the location, repository will be
857
relpath is the portion of the path that is contained by the innermost
860
If no tree, branch or repository is found, a NotBranchError is raised.
862
bzrdir, relpath = klass.open_containing(location)
864
tree, branch = bzrdir._get_tree_branch()
865
except errors.NotBranchError:
867
repo = bzrdir.find_repository()
868
return None, None, repo, relpath
869
except (errors.NoRepositoryPresent):
870
raise errors.NotBranchError(location)
871
return tree, branch, branch.repository, relpath
847
873
def open_repository(self, _unsupported=False):
848
874
"""Open the repository object at this BzrDir if one is present.