~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/controldir.py

(jelmer) Reduce the number of connections made during "bzr branch
 --stacked". (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
"""
24
24
 
25
 
from __future__ import absolute_import
26
 
 
27
25
from bzrlib.lazy_import import lazy_import
28
26
lazy_import(globals(), """
29
27
import textwrap
108
106
        """Return a sequence of all branches local to this control directory.
109
107
 
110
108
        """
111
 
        return self.get_branches().values()
112
 
 
113
 
    def get_branches(self):
114
 
        """Get all branches in this control directory, as a dictionary.
115
 
        
116
 
        :return: Dictionary mapping branch names to instances.
117
 
        """
118
109
        try:
119
 
           return { None: self.open_branch() }
 
110
            return [self.open_branch()]
120
111
        except (errors.NotBranchError, errors.NoRepositoryPresent):
121
 
           return {}
 
112
            return []
122
113
 
123
114
    def is_control_filename(self, filename):
124
115
        """True if filename is the name of a path which is reserved for
330
321
        raise NotImplementedError(self.cloning_metadir)
331
322
 
332
323
    def checkout_metadir(self):
333
 
        """Produce a metadir suitable for checkouts of this controldir.
334
 
 
335
 
        :returns: A ControlDirFormat with all component formats
336
 
            either set appropriately or set to None if that component
337
 
            should not be created.
338
 
        """
 
324
        """Produce a metadir suitable for checkouts of this controldir."""
339
325
        return self.cloning_metadir()
340
326
 
341
327
    def sprout(self, url, revision_id=None, force_new_repo=False,
740
726
                return result, urlutils.unescape(a_transport.relpath(url))
741
727
            except errors.NotBranchError, e:
742
728
                pass
743
 
            except errors.PermissionDenied:
744
 
                pass
745
729
            try:
746
730
                new_t = a_transport.clone('..')
747
731
            except errors.InvalidURLJoin:
846
830
 
847
831
    upgrade_recommended = False
848
832
 
 
833
    def get_format_string(self):
 
834
        """Return the format of this format, if usable in meta directories."""
 
835
        raise NotImplementedError(self.get_format_string)
 
836
 
849
837
    def get_format_description(self):
850
838
        """Return the short description for this format."""
851
839
        raise NotImplementedError(self.get_format_description)
878
866
            ui.ui_factory.recommend_upgrade(
879
867
                self.get_format_description(), basedir)
880
868
 
881
 
    @classmethod
882
 
    def get_format_string(cls):
883
 
        raise NotImplementedError(cls.get_format_string)
884
 
 
885
869
 
886
870
class ControlComponentFormatRegistry(registry.FormatRegistry):
887
871
    """A registry for control components (branch, workingtree, repository)."""