/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/repofmt/pack_repo.py

  • Committer: Andrew Bennetts
  • Date: 2009-08-30 23:59:59 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-20090830235959-hgvy9r7levgjh639
Rough code to reject commit_write_group if any inventory's CHK root is absent.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2073
2073
                ):
2074
2074
            missing = versioned_file.get_missing_compression_parent_keys()
2075
2075
            all_missing.update([(prefix,) + key for key in missing])
 
2076
        if getattr(self.repo, 'chk_bytes', None) is not None:
 
2077
            # - find new inventories
 
2078
            new_inventories_keys = self.repo.inventories._index._new_keys
 
2079
            # - ensure chk root keys are present for each inventory
 
2080
            rev_ids = [key[-1] for key in new_inventories_keys]
 
2081
            for new_inv in self.repo.iter_inventories(rev_ids, 'unordered'):
 
2082
                root_keys = [new_inv.id_to_entry.key()]
 
2083
                if getattr(new_inv, 'parent_id_basename_to_file_id', None) is not None:
 
2084
                    root_keys.append(
 
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?)
2076
2092
        if all_missing:
2077
2093
            raise errors.BzrCheckError(
2078
2094
                "Repository %s has missing compression parent(s) %r "