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
157
154
Used before calls to self._real_bzrdir.
159
156
if not self._real_bzrdir:
160
if 'hpssvfs' in debug.debug_flags:
162
warning('VFS BzrDir access triggered\n%s',
163
''.join(traceback.format_stack()))
164
157
self._real_bzrdir = BzrDir.open_from_transport(
165
158
self.root_transport, _server_formats=False)
166
159
self._format._network_name = \
287
280
def _get_branch_reference(self):
288
281
path = self._path_for_remote_call(self._client)
289
282
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):
283
if not medium._is_remote_before((1, 13)):
299
response = self._call(verb, path)
285
response = self._call('BzrDir.open_branchV2', path)
286
if response[0] not in ('ref', 'branch'):
287
raise errors.UnexpectedSmartServerResponse(response)
300
289
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'):
290
medium._remember_remote_is_before((1, 13))
291
response = self._call('BzrDir.open_branch', path)
292
if response[0] != 'ok':
314
293
raise errors.UnexpectedSmartServerResponse(response)
294
if response[1] != '':
295
return ('ref', response[1])
297
return ('branch', '')
317
299
def _get_tree_branch(self):
318
300
"""See BzrDir._get_tree_branch()."""
615
597
return self._custom_format._fetch_reconcile
617
599
def get_format_description(self):
619
return 'Remote: ' + self._custom_format.get_format_description()
600
return 'bzr remote repository'
621
602
def __eq__(self, other):
622
603
return self.__class__ is other.__class__
965
946
def is_write_locked(self):
966
947
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
949
def lock_read(self):
974
950
# wrong eventually - want a local lock cache context
975
951
if not self._lock_mode:
1497
1473
return self._real_repository.get_signature_text(revision_id)
1499
1475
@needs_read_lock
1500
def _get_inventory_xml(self, revision_id):
1502
return self._real_repository._get_inventory_xml(revision_id)
1476
def get_inventory_xml(self, revision_id):
1478
return self._real_repository.get_inventory_xml(revision_id)
1480
def deserialise_inventory(self, revision_id, xml):
1482
return self._real_repository.deserialise_inventory(revision_id, xml)
1504
1484
def reconcile(self, other=None, thorough=False):
1505
1485
self._ensure_real()
2833
2812
raise NoSuchRevision(find('branch'), err.error_args[0])
2834
2813
elif err.error_verb == 'nosuchrevision':
2835
2814
raise NoSuchRevision(find('repository'), err.error_args[0])
2836
elif err.error_verb == 'nobranch':
2837
if len(err.error_args) >= 1:
2838
extra = err.error_args[0]
2841
raise errors.NotBranchError(path=find('bzrdir').root_transport.base,
2815
elif err.error_tuple == ('nobranch',):
2816
raise errors.NotBranchError(path=find('bzrdir').root_transport.base)
2843
2817
elif err.error_verb == 'norepository':
2844
2818
raise errors.NoRepositoryPresent(find('bzrdir'))
2845
2819
elif err.error_verb == 'LockContention':