~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Ian Clatworthy
  • Date: 2008-07-04 03:29:14 UTC
  • mfrom: (3015.3.59 check)
  • mto: This revision was merged to the branch mainline in revision 3521.
  • Revision ID: ian.clatworthy@canonical.com-20080704032914-ymz2feecr4qxe160
Fix check to understand split up .bzr format (Daniel Mark Watkins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
    sha_strings,
62
62
    sha_string,
63
63
    )
 
64
from bzrlib.repository import Repository
64
65
from bzrlib.smart.client import _SmartClient
65
66
from bzrlib.smart import protocol
66
67
from bzrlib.store.versioned import WeaveStore
844
845
        tree, branch = bzrdir._get_tree_branch()
845
846
        return tree, branch, relpath
846
847
 
 
848
    @classmethod
 
849
    def open_containing_tree_branch_or_repository(klass, location):
 
850
        """Return the working tree, branch and repo contained by a location.
 
851
 
 
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
 
856
        None.
 
857
        relpath is the portion of the path that is contained by the innermost
 
858
        BzrDir.
 
859
 
 
860
        If no tree, branch or repository is found, a NotBranchError is raised.
 
861
        """
 
862
        bzrdir, relpath = klass.open_containing(location)
 
863
        try:
 
864
            tree, branch = bzrdir._get_tree_branch()
 
865
        except errors.NotBranchError:
 
866
            try:
 
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
 
872
 
847
873
    def open_repository(self, _unsupported=False):
848
874
        """Open the repository object at this BzrDir if one is present.
849
875