679
679
b = self.open_branch(name=name)
682
def get_branches(self, possible_transports=None, ignore_fallbacks=False):
683
path = self._path_for_remote_call(self._client)
685
response, handler = self._call_expecting_body(
686
'BzrDir.get_branches', path)
687
except errors.UnknownSmartMethod:
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())
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)
700
def set_branch_reference(self, target_branch, name=None):
701
"""See BzrDir.set_branch_reference()."""
703
return self._real_bzrdir.set_branch_reference(target_branch, name=name)
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)
727
def open_branch(self, name=None, unsupported=False,
728
ignore_fallbacks=False, possible_transports=None):
730
name = self._get_selected_branch()
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
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):
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)
766
def open_branch(self, name=None, unsupported=False,
767
ignore_fallbacks=False, possible_transports=None):
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
775
response = self._get_branch_reference()
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)
753
782
def _open_repo_v1(self, path):
754
783
verb = 'BzrDir.find_repository'
755
784
response = self._call(verb, path)