~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

Batch revision retrieval in InterDifferingSerializer to reduce the
        number of network round trips.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
    symbol_versioning,
39
39
    tsort,
40
40
    ui,
 
41
    versionedfile,
41
42
    )
42
43
from bzrlib.bundle import serializer
43
44
from bzrlib.revisiontree import RevisionTree
3090
3091
        revision_ids = tsort.topo_sort(
3091
3092
            self.source.get_graph().get_parent_map(revision_ids))
3092
3093
        def revisions_iterator():
3093
 
            for current_revision_id in revision_ids:
3094
 
                revision = self.source.get_revision(current_revision_id)
3095
 
                tree = self.source.revision_tree(current_revision_id)
3096
 
                try:
3097
 
                    signature = self.source.get_signature_text(
3098
 
                        current_revision_id)
3099
 
                except errors.NoSuchRevision:
3100
 
                    signature = None
3101
 
                yield revision, tree, signature
 
3094
            rev_ids = list(revision_ids)
 
3095
            for offset in xrange(0, len(rev_ids), 100):
 
3096
                current_revids = rev_ids[offset:offset+100]
 
3097
                revisions = self.source.get_revisions(current_revids)
 
3098
                trees = self.source.revision_trees(current_revids)
 
3099
                keys = [(r,) for r in current_revids]
 
3100
                sig_stream = self.source.signatures.get_record_stream(
 
3101
                    keys, 'unordered', True)
 
3102
                sigs = {}
 
3103
                for record in versionedfile.filter_absent(sig_stream):
 
3104
                    sigs[record.key[0]] = record.get_bytes_as('fulltext')
 
3105
                for rev, tree in zip(revisions, trees):
 
3106
                    yield rev, tree, sigs.get(rev.revision_id, None)
3102
3107
        if pb is None:
3103
3108
            my_pb = ui.ui_factory.nested_progress_bar()
3104
3109
            pb = my_pb