1
# Copyright (C) 2006-2010 Canonical Ltd
1
# Copyright (C) 2006, 2007, 2008, 2009 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
287
284
def _get_branch_reference(self):
288
285
path = self._path_for_remote_call(self._client)
289
286
medium = self._client._medium
291
('BzrDir.open_branchV3', (2, 1)),
292
('BzrDir.open_branchV2', (1, 13)),
293
('BzrDir.open_branch', None),
295
for verb, required_version in candidate_calls:
296
if required_version and medium._is_remote_before(required_version):
287
if not medium._is_remote_before((1, 13)):
299
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)
300
293
except errors.UnknownSmartMethod:
301
if required_version is None:
303
medium._remember_remote_is_before(required_version)
306
if verb == 'BzrDir.open_branch':
307
if response[0] != 'ok':
308
raise errors.UnexpectedSmartServerResponse(response)
309
if response[1] != '':
310
return ('ref', response[1])
312
return ('branch', '')
313
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':
314
297
raise errors.UnexpectedSmartServerResponse(response)
298
if response[1] != '':
299
return ('ref', response[1])
301
return ('branch', '')
317
303
def _get_tree_branch(self):
318
304
"""See BzrDir._get_tree_branch()."""
965
951
def is_write_locked(self):
966
952
return self._lock_mode == 'w'
968
def _warn_if_deprecated(self, branch=None):
969
# If we have a real repository, the check will be done there, if we
970
# don't the check will be done remotely.
973
954
def lock_read(self):
974
955
# wrong eventually - want a local lock cache context
975
956
if not self._lock_mode:
1497
1478
return self._real_repository.get_signature_text(revision_id)
1499
1480
@needs_read_lock
1500
def _get_inventory_xml(self, revision_id):
1481
def get_inventory_xml(self, revision_id):
1501
1482
self._ensure_real()
1502
return self._real_repository._get_inventory_xml(revision_id)
1483
return self._real_repository.get_inventory_xml(revision_id)
1504
def _deserialise_inventory(self, revision_id, xml):
1485
def deserialise_inventory(self, revision_id, xml):
1505
1486
self._ensure_real()
1506
return self._real_repository._deserialise_inventory(revision_id, xml)
1487
return self._real_repository.deserialise_inventory(revision_id, xml)
1508
1489
def reconcile(self, other=None, thorough=False):
1509
1490
self._ensure_real()
2837
2818
raise NoSuchRevision(find('branch'), err.error_args[0])
2838
2819
elif err.error_verb == 'nosuchrevision':
2839
2820
raise NoSuchRevision(find('repository'), err.error_args[0])
2840
elif err.error_verb == 'nobranch':
2841
if len(err.error_args) >= 1:
2842
extra = err.error_args[0]
2845
raise errors.NotBranchError(path=find('bzrdir').root_transport.base,
2821
elif err.error_tuple == ('nobranch',):
2822
raise errors.NotBranchError(path=find('bzrdir').root_transport.base)
2847
2823
elif err.error_verb == 'norepository':
2848
2824
raise errors.NoRepositoryPresent(find('bzrdir'))
2849
2825
elif err.error_verb == 'LockContention':