~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/groupcompress_repo.py

(parthm) Estimated records to be fetched are now shown for fetch (2a only).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1108
1108
        yield 'chk_bytes', _get_parent_id_basename_to_file_id_pages()
1109
1109
 
1110
1110
    def get_stream(self, search):
 
1111
        def wrap_and_count(pb, rc, stream):
 
1112
            """Yield records from stream while showing progress."""
 
1113
            count = 0
 
1114
            for record in stream:
 
1115
                if count == rc.STEP:
 
1116
                    rc.increment(count)
 
1117
                    pb.update('Estimate', rc.current, rc.max)
 
1118
                    count = 0
 
1119
                count += 1
 
1120
                yield record
 
1121
 
1111
1122
        revision_ids = search.get_keys()
 
1123
        pb = ui.ui_factory.nested_progress_bar()
 
1124
        rc = self._record_counter
 
1125
        self._record_counter.setup(len(revision_ids))
1112
1126
        for stream_info in self._fetch_revision_texts(revision_ids):
1113
 
            yield stream_info
 
1127
            yield (stream_info[0],
 
1128
                wrap_and_count(pb, rc, stream_info[1]))
1114
1129
        self._revision_keys = [(rev_id,) for rev_id in revision_ids]
1115
1130
        self.from_repository.revisions.clear_cache()
1116
1131
        self.from_repository.signatures.clear_cache()
1117
 
        yield self._get_inventory_stream(self._revision_keys)
 
1132
        s = self._get_inventory_stream(self._revision_keys)
 
1133
        yield (s[0], wrap_and_count(pb, rc, s[1]))
1118
1134
        self.from_repository.inventories.clear_cache()
1119
1135
        # TODO: The keys to exclude might be part of the search recipe
1120
1136
        # For now, exclude all parents that are at the edge of ancestry, for
1123
1139
        parent_keys = from_repo._find_parent_keys_of_revisions(
1124
1140
                        self._revision_keys)
1125
1141
        for stream_info in self._get_filtered_chk_streams(parent_keys):
1126
 
            yield stream_info
 
1142
            yield (stream_info[0], wrap_and_count(pb, rc, stream_info[1]))
1127
1143
        self.from_repository.chk_bytes.clear_cache()
1128
 
        yield self._get_text_stream()
 
1144
        s = self._get_text_stream()
 
1145
        yield (s[0], wrap_and_count(pb, rc, s[1]))
1129
1146
        self.from_repository.texts.clear_cache()
 
1147
        pb.update('Done', rc.max, rc.max)
 
1148
        pb.finished()
1130
1149
 
1131
1150
    def get_stream_for_missing_keys(self, missing_keys):
1132
1151
        # missing keys can only occur when we are byte copying and not