~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

Don't add a new verb; instead just teach the client to fallback if it gets a BadSearch error.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1970
1970
        search_bytes = repo._serialise_search_result(search)
1971
1971
        args = (path, self.to_format.network_name())
1972
1972
        candidate_verbs = [
1973
 
            ('Repository.get_stream_2.3', (2, 3)),
1974
1973
            ('Repository.get_stream_1.19', (1, 19)),
1975
1974
            ('Repository.get_stream', (1, 13))]
1976
1975
 
1978
1977
        for verb, version in candidate_verbs:
1979
1978
            if medium._is_remote_before(version):
1980
1979
                continue
1981
 
            if isinstance(search, graph.EverythingResult) and version < (2, 3):
1982
 
                # EverythingResult is new in 2.3
1983
 
                continue
1984
1980
            try:
1985
1981
                response = repo._call_with_body_bytes_expecting_body(
1986
1982
                    verb, args, search_bytes)
1987
1983
            except errors.UnknownSmartMethod:
1988
1984
                medium._remember_remote_is_before(version)
 
1985
            except errors.UnknownErrorFromSmartServer, e:
 
1986
                if isinstance(search, graph.EverythingResult):
 
1987
                    error_verb = e.error_from_smart_server.error_verb
 
1988
                    if error_verb == 'BadSearch':
 
1989
                        # Pre-2.3 servers don't support this sort of search.
 
1990
                        # XXX: perhaps falling back to VFS on BadSearch is a
 
1991
                        # good idea in general?  It might provide a little bit
 
1992
                        # of protection against client-side bugs.
 
1993
                        medium._remember_remote_is_before((2, 3))
 
1994
                        break
 
1995
                raise
1989
1996
            else:
1990
1997
                response_tuple, response_handler = response
1991
1998
                found_verb = True