~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/pack_repo.py

  • Committer: Andrew Bennetts
  • Date: 2009-08-31 00:56:13 UTC
  • mto: (4634.6.23 2.0)
  • mto: This revision was merged to the branch mainline in revision 4676.
  • Revision ID: andrew.bennetts@canonical.com-20090831005613-3irf84hp5m252yyh
Simplify.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2074
2074
            missing = versioned_file.get_missing_compression_parent_keys()
2075
2075
            all_missing.update([(prefix,) + key for key in missing])
2076
2076
        if getattr(self.repo, 'chk_bytes', None) is not None:
2077
 
            # - find new inventories
 
2077
            # Ensure that all inventories added in this write group have their
 
2078
            # corresponding chk_bytes present.
2078
2079
            new_inventories_keys = self.repo.inventories._index._new_keys
2079
 
            # - ensure chk root keys are present for each inventory
2080
2080
            rev_ids = [key[-1] for key in new_inventories_keys]
2081
2081
            for new_inv in self.repo.iter_inventories(rev_ids, 'unordered'):
2082
 
                root_keys = [new_inv.id_to_entry.key()]
 
2082
                root_keys = set([new_inv.id_to_entry.key()])
2083
2083
                if getattr(new_inv, 'parent_id_basename_to_file_id', None) is not None:
2084
 
                    root_keys.append(
 
2084
                    root_keys.add(
2085
2085
                        new_inv.parent_id_basename_to_file_id.key())
2086
 
                chk_stream = self.repo.chk_bytes.get_record_stream(
2087
 
                    root_keys, 'unordered', True)
2088
 
                for chk_bytes in chk_stream:
2089
 
                    if chk_bytes.storage_kind == 'absent':
2090
 
                        all_missing.add(('chk_bytes',) + chk_bytes.key)
2091
 
            # - (ensure all chk children for those roots are present?)
 
2086
                present = self.repo.chk_bytes.get_parent_map(root_keys)
 
2087
                missing = root_keys.difference(present)
 
2088
                all_missing.update([('chk_bytes',) + key for key in missing])
2092
2089
        if all_missing:
2093
2090
            raise errors.BzrCheckError(
2094
2091
                "Repository %s has missing compression parent(s) %r "