~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/controldir.py

(vila) Provide a config section matcher respecting the file order. (Vincent
 Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
116
116
        :return: Dictionary mapping branch names to instances.
117
117
        """
118
118
        try:
119
 
           return { "": self.open_branch() }
 
119
           return { None: self.open_branch() }
120
120
        except (errors.NotBranchError, errors.NoRepositoryPresent):
121
121
           return {}
122
122
 
230
230
            raise errors.NoColocatedBranchSupport(self)
231
231
        return None
232
232
 
233
 
    def set_branch_reference(self, target_branch, name=None):
234
 
        """Set the referenced URL for the branch in this controldir.
235
 
 
236
 
        :param name: Optional colocated branch name
237
 
        :param target_branch: Branch to reference
238
 
        :raises NoColocatedBranchSupport: If a branch name was specified
239
 
            but colocated branches are not supported.
240
 
        :return: The referencing branch
241
 
        """
242
 
        raise NotImplementedError(self.set_branch_reference)
243
 
 
244
233
    def open_branch(self, name=None, unsupported=False,
245
234
                    ignore_fallbacks=False, possible_transports=None):
246
235
        """Open the branch object at this ControlDir if one is present.
305
294
        :return: Name of the branch selected by the user, or None.
306
295
        """
307
296
        branch = self.root_transport.get_segment_parameters().get("branch")
308
 
        if branch is None:
309
 
            branch = ""
310
 
        return urlutils.unescape(branch)
 
297
        if branch is not None:
 
298
            branch = urlutils.unescape(branch)
 
299
        return branch
311
300
 
312
301
    def has_workingtree(self):
313
302
        """Tell if this controldir contains a working tree.
778
767
        return controldir._get_tree_branch()
779
768
 
780
769
    @classmethod
781
 
    def open_containing_tree_or_branch(klass, location,
782
 
            possible_transports=None):
 
770
    def open_containing_tree_or_branch(klass, location):
783
771
        """Return the branch and working tree contained by a location.
784
772
 
785
773
        Returns (tree, branch, relpath).
788
776
        raised
789
777
        relpath is the portion of the path that is contained by the branch.
790
778
        """
791
 
        controldir, relpath = klass.open_containing(location,
792
 
            possible_transports=possible_transports)
 
779
        controldir, relpath = klass.open_containing(location)
793
780
        tree, branch = controldir._get_tree_branch()
794
781
        return tree, branch, relpath
795
782