~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/groupcompress_repo.py

  • Committer: John Arbash Meinel
  • Date: 2009-05-11 18:59:15 UTC
  • mto: This revision was merged to the branch mainline in revision 4392.
  • Revision ID: john@arbash-meinel.com-20090511185915-syglc7tz3vsprwpu
Some cleanup passes.

move test_resume_chk_bytes from per_repository_referece to test_pack_repository,
as it is a bit more implementation specific.
Make sure we don't allow get_stream_for_missing_keys() if we have a pending stream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
171
171
 
172
172
class ResumedGCPack(ResumedPack):
173
173
 
 
174
    def _check_references(self):
 
175
        """Make sure our external compression parents are present."""
 
176
        # See GCPack._check_references for why this is empty
 
177
 
174
178
    def _get_external_refs(self, index):
175
179
        # GC repositories don't have compression parents external to a given
176
180
        # pack file
 
181
        bork
177
182
        return set()
178
183
 
179
184
 
928
933
                    self._text_keys.add((file_id, revision_id))
929
934
                if record is not None:
930
935
                    yield record
 
936
            # Consumed
 
937
            self._chk_id_roots = None
931
938
        yield 'chk_bytes', _filter_id_to_entry()
932
939
        def _get_parent_id_basename_to_file_id_pages():
933
940
            for record, items in chk_map.iter_interesting_nodes(chk_bytes,
934
941
                        self._chk_p_id_roots, uninteresting_pid_root_keys):
935
942
                if record is not None:
936
943
                    yield record
 
944
            # Consumed
 
945
            self._chk_p_id_roots = None
937
946
        yield 'chk_bytes', _get_parent_id_basename_to_file_id_pages()
938
947
 
939
948
    def _get_text_stream(self):
960
969
        # missing keys can only occur when we are byte copying and not
961
970
        # translating (because translation means we don't send
962
971
        # unreconstructable deltas ever).
963
 
        keys = {}
964
 
        keys['texts'] = set()
965
 
        keys['revisions'] = set()
966
 
        keys['inventories'] = set()
967
 
        keys['chk_bytes'] = set()
968
 
        keys['signatures'] = set()
 
972
        missing_inventory_keys = set()
969
973
        for key in missing_keys:
970
 
            keys[key[0]].add(key[1:])
971
 
        if len(keys['revisions']):
972
 
            # If we allowed copying revisions at this point, we could end up
973
 
            # copying a revision without copying its required texts: a
974
 
            # violation of the requirements for repository integrity.
975
 
            raise AssertionError(
976
 
                'cannot copy revisions to fill in missing deltas %s' % (
977
 
                    keys['revisions'],))
978
 
        for substream_kind in ['texts', 'chk_bytes', 'signatures']:
979
 
            if len(keys[substream_kind]) > 0:
 
974
            if key[0] != 'inventories':
980
975
                raise AssertionError('The only missing keys we should'
981
976
                    ' be filling in are inventory keys, not %s'
982
 
                    % (substream_kind,))
 
977
                    % (key[0],))
 
978
            missing_inventory_keys.add(key[1:])
 
979
        if self._chk_id_roots or self._chk_p_id_roots:
 
980
            raise AssertionError('Cannot call get_stream_for_missing_keys'
 
981
                ' untill all of get_stream() has been consumed.')
983
982
        # Yield the inventory stream, so we can find the chk stream
984
 
        yield self._get_inventory_stream(keys['inventories'])
 
983
        yield self._get_inventory_stream(missing_inventory_keys)
985
984
        # We use the empty set for excluded_keys, to make it clear that we want
986
985
        # to transmit all referenced chk pages.
987
986
        for stream_info in self._get_filtered_chk_streams(set()):