~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

  • Committer: Robert Collins
  • Date: 2010-01-08 06:33:05 UTC
  • mto: This revision was merged to the branch mainline in revision 4944.
  • Revision ID: robertc@robertcollins.net-20100108063305-qxgq2t7prgp0op1j
Adjust errors.py to fix missing references to 'warn'.

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
 
        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
 
287
        if not medium._is_remote_before((1, 13)):
295
288
            try:
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)
 
292
                return response
297
293
            except errors.UnknownSmartMethod:
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'):
 
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)
312
 
        return response
 
298
        if response[1] != '':
 
299
            return ('ref', response[1])
 
300
        else:
 
301
            return ('branch', '')
313
302
 
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]
2840
 
        else:
2841
 
            extra = None
2842
 
        raise errors.NotBranchError(path=find('bzrdir').root_transport.base,
2843
 
            detail=extra)
 
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':