284
284
def _get_branch_reference(self):
285
285
path = self._path_for_remote_call(self._client)
286
286
medium = self._client._medium
287
if not medium._is_remote_before((1, 13)):
288
('BzrDir.open_branchV3', (2, 1)),
289
('BzrDir.open_branchV2', (1, 13)),
290
('BzrDir.open_branch', None),
292
for verb, required_version in candidate_calls:
293
if required_version and medium._is_remote_before(required_version):
289
response = self._call('BzrDir.open_branchV2', path)
290
if response[0] not in ('ref', 'branch'):
291
raise errors.UnexpectedSmartServerResponse(response)
296
response = self._call(verb, path)
293
297
except errors.UnknownSmartMethod:
294
medium._remember_remote_is_before((1, 13))
295
response = self._call('BzrDir.open_branch', path)
296
if response[0] != 'ok':
298
if required_version is None:
300
medium._remember_remote_is_before(required_version)
303
if verb == 'BzrDir.open_branch':
304
if response[0] != 'ok':
305
raise errors.UnexpectedSmartServerResponse(response)
306
if response[1] != '':
307
return ('ref', response[1])
309
return ('branch', '')
310
if response[0] not in ('ref', 'branch'):
297
311
raise errors.UnexpectedSmartServerResponse(response)
298
if response[1] != '':
299
return ('ref', response[1])
301
return ('branch', '')
303
314
def _get_tree_branch(self):
304
315
"""See BzrDir._get_tree_branch()."""
2823
2834
raise NoSuchRevision(find('branch'), err.error_args[0])
2824
2835
elif err.error_verb == 'nosuchrevision':
2825
2836
raise NoSuchRevision(find('repository'), err.error_args[0])
2826
elif err.error_tuple == ('nobranch',):
2827
raise errors.NotBranchError(path=find('bzrdir').root_transport.base)
2828
2837
elif err.error_verb == 'nobranch':
2838
if len(err.error_args) >= 1:
2839
extra = err.error_args[0]
2829
2842
raise errors.NotBranchError(path=find('bzrdir').root_transport.base,
2830
detail=err.error_args[0])
2831
2844
elif err.error_verb == 'norepository':
2832
2845
raise errors.NoRepositoryPresent(find('bzrdir'))
2833
2846
elif err.error_verb == 'LockContention':