149
149
def open_repository(self):
150
150
path = self._path_for_remote_call(self._client)
151
response = self._client.call('BzrDir.find_repository', path)
151
verb = 'BzrDir.find_repositoryV2'
152
response = self._client.call(verb, path)
153
if (response == ('error', "Generic bzr smart protocol error: "
154
"bad request '%s'" % verb) or
155
response == ('error', "Generic bzr smart protocol error: "
156
"bad request u'%s'" % verb)):
157
verb = 'BzrDir.find_repository'
158
response = self._client.call(verb, path)
152
159
assert response[0] in ('ok', 'norepository'), \
153
160
'unexpected response code %s' % (response,)
154
161
if response[0] == 'norepository':
155
162
raise errors.NoRepositoryPresent(self)
156
assert len(response) == 4, 'incorrect response length %s' % (response,)
163
if verb == 'BzrDir.find_repository':
164
# servers that don't support the V2 method don't support external
166
response = response + ('no', )
167
assert len(response) == 5, 'incorrect response length %s' % (response,)
157
168
if response[1] == '':
158
169
format = RemoteRepositoryFormat()
159
170
format.rich_root_data = (response[2] == 'yes')
160
171
format.supports_tree_reference = (response[3] == 'yes')
161
172
# No wire format to check this yet.
162
format.supports_external_lookups = False
173
format.supports_external_lookups = (response[4] == 'yes')
163
174
return RemoteRepository(self, format)
165
176
raise errors.NoRepositoryPresent(self)