~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-23 15:31:35 UTC
  • mfrom: (6443.1.1 bzr.dev)
  • Revision ID: pqm@pqm.ubuntu.com-20120123153135-8v3r3z1lx055vmpl
(jelmer) Merge the 2.5 series branch. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
679
679
        b = self.open_branch(name=name)
680
680
        return b._format
681
681
 
 
682
    def get_branches(self, possible_transports=None, ignore_fallbacks=False):
 
683
        path = self._path_for_remote_call(self._client)
 
684
        try:
 
685
            response, handler = self._call_expecting_body(
 
686
                'BzrDir.get_branches', path)
 
687
        except errors.UnknownSmartMethod:
 
688
            self._ensure_real()
 
689
            return self._real_bzrdir.get_branches()
 
690
        if response[0] != "success":
 
691
            raise errors.UnexpectedSmartServerResponse(response)
 
692
        body = bencode.bdecode(handler.read_body_bytes())
 
693
        ret = {}
 
694
        for (name, value) in body.iteritems():
 
695
            ret[name] = self._open_branch(name, value[0], value[1],
 
696
                possible_transports=possible_transports,
 
697
                ignore_fallbacks=ignore_fallbacks)
 
698
        return ret
 
699
 
 
700
    def set_branch_reference(self, target_branch, name=None):
 
701
        """See BzrDir.set_branch_reference()."""
 
702
        self._ensure_real()
 
703
        return self._real_bzrdir.set_branch_reference(target_branch, name=name)
 
704
 
682
705
    def get_branch_reference(self, name=None):
683
706
        """See BzrDir.get_branch_reference()."""
684
707
        if name is not None:
724
747
        """See BzrDir._get_tree_branch()."""
725
748
        return None, self.open_branch(name=name)
726
749
 
727
 
    def open_branch(self, name=None, unsupported=False,
728
 
                    ignore_fallbacks=False, possible_transports=None):
729
 
        if name is None:
730
 
            name = self._get_selected_branch()
731
 
        if unsupported:
732
 
            raise NotImplementedError('unsupported flag support not implemented yet.')
733
 
        if self._next_open_branch_result is not None:
734
 
            # See create_branch for details.
735
 
            result = self._next_open_branch_result
736
 
            self._next_open_branch_result = None
737
 
            return result
738
 
        response = self._get_branch_reference()
739
 
        if response[0] == 'ref':
 
750
    def _open_branch(self, name, kind, location_or_format,
 
751
                     ignore_fallbacks=False, possible_transports=None):
 
752
        if kind == 'ref':
740
753
            # a branch reference, use the existing BranchReference logic.
741
754
            format = BranchReferenceFormat()
742
755
            return format.open(self, name=name, _found=True,
743
 
                location=response[1], ignore_fallbacks=ignore_fallbacks,
 
756
                location=location_or_format, ignore_fallbacks=ignore_fallbacks,
744
757
                possible_transports=possible_transports)
745
 
        branch_format_name = response[1]
 
758
        branch_format_name = location_or_format
746
759
        if not branch_format_name:
747
760
            branch_format_name = None
748
761
        format = RemoteBranchFormat(network_name=branch_format_name)
750
763
            setup_stacking=not ignore_fallbacks, name=name,
751
764
            possible_transports=possible_transports)
752
765
 
 
766
    def open_branch(self, name=None, unsupported=False,
 
767
                    ignore_fallbacks=False, possible_transports=None):
 
768
        if unsupported:
 
769
            raise NotImplementedError('unsupported flag support not implemented yet.')
 
770
        if self._next_open_branch_result is not None:
 
771
            # See create_branch for details.
 
772
            result = self._next_open_branch_result
 
773
            self._next_open_branch_result = None
 
774
            return result
 
775
        response = self._get_branch_reference()
 
776
        if name is None:
 
777
            name = self._get_selected_branch()
 
778
        return self._open_branch(name, response[0], response[1],
 
779
            possible_transports=possible_transports,
 
780
            ignore_fallbacks=ignore_fallbacks)
 
781
 
753
782
    def _open_repo_v1(self, path):
754
783
        verb = 'BzrDir.find_repository'
755
784
        response = self._call(verb, path)