284
284
def _get_branch_reference(self):
285
285
path = self._path_for_remote_call(self._client)
286
286
medium = self._client._medium
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):
287
if not medium._is_remote_before((1, 13)):
296
response = self._call(verb, path)
289
response = self._call('BzrDir.open_branchV2', path)
290
if response[0] not in ('ref', 'branch'):
291
raise errors.UnexpectedSmartServerResponse(response)
297
293
except errors.UnknownSmartMethod:
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'):
294
medium._remember_remote_is_before((1, 13))
295
response = self._call('BzrDir.open_branch', path)
296
if response[0] != 'ok':
311
297
raise errors.UnexpectedSmartServerResponse(response)
298
if response[1] != '':
299
return ('ref', response[1])
301
return ('branch', '')
314
303
def _get_tree_branch(self):
315
304
"""See BzrDir._get_tree_branch()."""
2834
2823
raise NoSuchRevision(find('branch'), err.error_args[0])
2835
2824
elif err.error_verb == 'nosuchrevision':
2836
2825
raise NoSuchRevision(find('repository'), err.error_args[0])
2837
elif err.error_verb == 'nobranch':
2838
if len(err.error_args) >= 1:
2839
extra = err.error_args[0]
2842
raise errors.NotBranchError(path=find('bzrdir').root_transport.base,
2826
elif err.error_tuple == ('nobranch',):
2827
raise errors.NotBranchError(path=find('bzrdir').root_transport.base)
2844
2828
elif err.error_verb == 'norepository':
2845
2829
raise errors.NoRepositoryPresent(find('bzrdir'))
2846
2830
elif err.error_verb == 'LockContention':