~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

  • Committer: Patch Queue Manager
  • Date: 2012-01-28 13:24:39 UTC
  • mfrom: (6450.1.1 bzr.dev)
  • Revision ID: pqm@pqm.ubuntu.com-20120128132439-phvlss4cq7bf5rji
(jelmer) Merge the 2.5 branch. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
from bzrlib.repository import RepositoryWriteLockResult, _LazyListJoin
60
60
from bzrlib.serializer import format_registry as serializer_format_registry
61
61
from bzrlib.trace import mutter, note, warning, log_exception_quietly
62
 
from bzrlib.versionedfile import ChunkedContentFactory, FulltextContentFactory
 
62
from bzrlib.versionedfile import FulltextContentFactory
63
63
 
64
64
 
65
65
_DEFAULT_SEARCH_DEPTH = 100
113
113
 
114
114
    supports_workingtrees = False
115
115
 
 
116
    colocated_branches = False
 
117
 
116
118
    def __init__(self):
117
119
        _mod_bzrdir.BzrDirMetaFormat1.__init__(self)
118
120
        # XXX: It's a bit ugly that the network name is here, because we'd
627
629
                      append_revisions_only=None):
628
630
        if name is None:
629
631
            name = self._get_selected_branch()
 
632
        if name != "":
 
633
            raise errors.NoColocatedBranchSupport(self)
630
634
        # as per meta1 formats - just delegate to the format object which may
631
635
        # be parameterised.
632
636
        real_branch = self._format.get_branch_format().initialize(self,
651
655
 
652
656
    def destroy_branch(self, name=None):
653
657
        """See BzrDir.destroy_branch"""
 
658
        if name is None:
 
659
            name = self._get_selected_branch()
 
660
        if name != "":
 
661
            raise errors.NoColocatedBranchSupport(self)
654
662
        path = self._path_for_remote_call(self._client)
655
663
        try:
656
 
            if name is not None:
 
664
            if name != "":
657
665
                args = (name, )
658
666
            else:
659
667
                args = ()
699
707
 
700
708
    def set_branch_reference(self, target_branch, name=None):
701
709
        """See BzrDir.set_branch_reference()."""
 
710
        if name is None:
 
711
            name = self._get_selected_branch()
 
712
        if name != "":
 
713
            raise errors.NoColocatedBranchSupport(self)
702
714
        self._ensure_real()
703
715
        return self._real_bzrdir.set_branch_reference(target_branch, name=name)
704
716
 
705
717
    def get_branch_reference(self, name=None):
706
718
        """See BzrDir.get_branch_reference()."""
707
 
        if name is not None:
708
 
            # XXX JRV20100304: Support opening colocated branches
 
719
        if name is None:
 
720
            name = self._get_selected_branch()
 
721
        if name != "":
709
722
            raise errors.NoColocatedBranchSupport(self)
710
723
        response = self._get_branch_reference()
711
724
        if response[0] == 'ref':
765
778
 
766
779
    def open_branch(self, name=None, unsupported=False,
767
780
                    ignore_fallbacks=False, possible_transports=None):
 
781
        if name is None:
 
782
            name = self._get_selected_branch()
 
783
        if name != "":
 
784
            raise errors.NoColocatedBranchSupport(self)
768
785
        if unsupported:
769
786
            raise NotImplementedError('unsupported flag support not implemented yet.')
770
787
        if self._next_open_branch_result is not None:
773
790
            self._next_open_branch_result = None
774
791
            return result
775
792
        response = self._get_branch_reference()
776
 
        if name is None:
777
 
            name = self._get_selected_branch()
778
793
        return self._open_branch(name, response[0], response[1],
779
794
            possible_transports=possible_transports,
780
795
            ignore_fallbacks=ignore_fallbacks)
3122
3137
        if isinstance(a_bzrdir, RemoteBzrDir):
3123
3138
            a_bzrdir._ensure_real()
3124
3139
            result = self._custom_format.initialize(a_bzrdir._real_bzrdir,
3125
 
                name, append_revisions_only=append_revisions_only)
 
3140
                name=name, append_revisions_only=append_revisions_only)
3126
3141
        else:
3127
3142
            # We assume the bzrdir is parameterised; it may not be.
3128
 
            result = self._custom_format.initialize(a_bzrdir, name,
 
3143
            result = self._custom_format.initialize(a_bzrdir, name=name,
3129
3144
                append_revisions_only=append_revisions_only)
3130
3145
        if (isinstance(a_bzrdir, RemoteBzrDir) and
3131
3146
            not isinstance(result, RemoteBranch)):
3322
3337
        # will try to assign to self.tags, which is a property in this subclass.
3323
3338
        # And the parent's __init__ doesn't do much anyway.
3324
3339
        self.bzrdir = remote_bzrdir
 
3340
        self.name = name
3325
3341
        if _client is not None:
3326
3342
            self._client = _client
3327
3343
        else: