~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/controldir.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:
505
505
                push_result.branch_push_result.target_branch
506
506
        return push_result
507
507
 
 
508
    def _get_tree_branch(self, name=None):
 
509
        """Return the branch and tree, if any, for this bzrdir.
 
510
 
 
511
        :param name: Name of colocated branch to open.
 
512
 
 
513
        Return None for tree if not present or inaccessible.
 
514
        Raise NotBranchError if no branch is present.
 
515
        :return: (tree, branch)
 
516
        """
 
517
        try:
 
518
            tree = self.open_workingtree()
 
519
        except (errors.NoWorkingTree, errors.NotLocalUrl):
 
520
            tree = None
 
521
            branch = self.open_branch(name=name)
 
522
        else:
 
523
            if name is not None:
 
524
                branch = self.open_branch(name=name)
 
525
            else:
 
526
                branch = tree.branch
 
527
        return tree, branch
 
528
 
 
529
 
 
530
 
508
531
 
509
532
class ControlDirFormat(object):
510
533
    """An encapsulation of the initialization and open routines for a format.