/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

Merge description into dont-add-conflict-helpers

Show diffs side-by-side

added added

removed removed

Lines of Context:
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)):
 
287
        candidate_calls = [
 
288
            ('BzrDir.open_branchV3', (2, 1)),
 
289
            ('BzrDir.open_branchV2', (1, 13)),
 
290
            ('BzrDir.open_branch', None),
 
291
            ]
 
292
        for verb, required_version in candidate_calls:
 
293
            if required_version and medium._is_remote_before(required_version):
 
294
                continue
288
295
            try:
289
 
                response = self._call('BzrDir.open_branchV2', path)
290
 
                if response[0] not in ('ref', 'branch'):
291
 
                    raise errors.UnexpectedSmartServerResponse(response)
292
 
                return 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:
 
299
                    raise
 
300
                medium._remember_remote_is_before(required_version)
 
301
            else:
 
302
                break
 
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])
 
308
            else:
 
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])
300
 
        else:
301
 
            return ('branch', '')
 
312
        return response
302
313
 
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)
 
2837
    elif err.error_verb == 'nobranch':
 
2838
        if len(err.error_args) >= 1:
 
2839
            extra = err.error_args[0]
 
2840
        else:
 
2841
            extra = None
 
2842
        raise errors.NotBranchError(path=find('bzrdir').root_transport.base,
 
2843
            detail=extra)
2828
2844
    elif err.error_verb == 'norepository':
2829
2845
        raise errors.NoRepositoryPresent(find('bzrdir'))
2830
2846
    elif err.error_verb == 'LockContention':