~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Aaron Bentley
  • Date: 2007-01-17 15:39:21 UTC
  • mfrom: (1551.9.35 Aaron's mergeable stuff)
  • mto: This revision was merged to the branch mainline in revision 2239.
  • Revision ID: abentley@panoramicfeedback.com-20070117153921-6pp9ssa2r8n5izoo
Merge bzr.ab, to avoid conflicts submitting

Show diffs side-by-side

added added

removed removed

Lines of Context:
558
558
                raise errors.NotBranchError(path=url)
559
559
            a_transport = new_t
560
560
 
 
561
    @classmethod
 
562
    def open_containing_tree_or_branch(klass, location):
 
563
        """Return the branch and working tree contained by a location.
 
564
 
 
565
        Returns (tree, branch, relpath).
 
566
        If there is no tree at containing the location, tree will be None.
 
567
        If there is no branch containing the location, an exception will be
 
568
        raised
 
569
        relpath is the portion of the path that is contained by the branch.
 
570
        """
 
571
        bzrdir, relpath = klass.open_containing(location)
 
572
        try:
 
573
            tree = bzrdir.open_workingtree()
 
574
        except (errors.NoWorkingTree, errors.NotLocalUrl):
 
575
            tree = None
 
576
            branch = bzrdir.open_branch()
 
577
        else:
 
578
            branch = tree.branch
 
579
        return tree, branch, relpath
 
580
 
561
581
    def open_repository(self, _unsupported=False):
562
582
        """Open the repository object at this BzrDir if one is present.
563
583