/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/smart/repository.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:
81
81
            recreate_search trusts that clients will look for missing things
82
82
            they expected and get it from elsewhere.
83
83
        """
 
84
        if search_bytes == 'everything':
 
85
            return graph.EverythingResult(repository), None
84
86
        lines = search_bytes.split('\n')
85
87
        if lines[0] == 'ancestry-of':
86
88
            heads = lines[1:]
412
414
    def do_repository_request(self, repository, to_network_name):
413
415
        """Get a stream for inserting into a to_format repository.
414
416
 
 
417
        The request body is 'search_bytes', a description of the revisions
 
418
        being requested.
 
419
 
 
420
        In 2.3 this verb added support for search_bytes == 'everything'.  Older
 
421
        implementations will respond with a BadSearch error, and clients should
 
422
        catch this and fallback appropriately.
 
423
 
415
424
        :param repository: The repository to stream from.
416
425
        :param to_network_name: The network name of the format of the target
417
426
            repository.
489
498
 
490
499
 
491
500
class SmartServerRepositoryGetStream_1_19(SmartServerRepositoryGetStream):
 
501
    """The same as Repository.get_stream, but will return stream CHK formats to
 
502
    clients.
 
503
 
 
504
    See SmartServerRepositoryGetStream._should_fake_unknown.
 
505
    
 
506
    New in 1.19.
 
507
    """
492
508
 
493
509
    def _should_fake_unknown(self):
494
510
        """Returns False; we don't need to workaround bugs in 1.19+ clients."""
495
511
        return False
496
512
 
497
513
 
498
 
class SmartServerRepositoryGetStream_2_3(SmartServerRepositoryGetStream_1_19):
499
 
    """Adds support for search_bytes == 'everything'.
500
 
    
501
 
    New in 2.3.
502
 
    """
503
 
 
504
 
    def recreate_search(self, repository, search_bytes, discard_excess=False):
505
 
        if search_bytes == 'everything':
506
 
            return graph.EverythingResult(repository), None
507
 
        return super(SmartServerRepositoryGetStream_2_3, self).recreate_search(
508
 
            repository, search_bytes, discard_excess=discard_excess)
509
 
 
510
 
 
511
514
def _stream_to_byte_stream(stream, src_format):
512
515
    """Convert a record stream to a self delimited byte stream."""
513
516
    pack_writer = pack.ContainerSerialiser()