~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/groupcompress_repo.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-04-19 02:03:54 UTC
  • mfrom: (5757.8.11 knitpackrepo-7)
  • Revision ID: pqm@pqm.ubuntu.com-20110419020354-qu7nt76r2uj4pb5c
(jelmer) Move _KeyRefs from bzrlib.knit to bzrlib.versionedfile. (Jelmer
 Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
799
799
    def __init__(self, _format, a_bzrdir, control_files, _commit_builder_class,
800
800
        _serializer):
801
801
        """Overridden to change pack collection class."""
802
 
        super(CHKInventoryRepository, self).__init__(_format, a_bzrdir, control_files,
803
 
            _commit_builder_class, _serializer)
 
802
        super(CHKInventoryRepository, self).__init__(_format, a_bzrdir,
 
803
            control_files, _commit_builder_class, _serializer)
804
804
        index_transport = self._transport.clone('indices')
805
805
        self._pack_collection = GCRepositoryPackCollection(self,
806
806
            self._transport, index_transport,
1109
1109
            return GroupCHKStreamSource(self, to_format)
1110
1110
        return super(CHKInventoryRepository, self)._get_source(to_format)
1111
1111
 
 
1112
    def _find_inconsistent_revision_parents(self, revisions_iterator=None):
 
1113
        """Find revisions with different parent lists in the revision object
 
1114
        and in the index graph.
 
1115
 
 
1116
        :param revisions_iterator: None, or an iterator of (revid,
 
1117
            Revision-or-None). This iterator controls the revisions checked.
 
1118
        :returns: an iterator yielding tuples of (revison-id, parents-in-index,
 
1119
            parents-in-revision).
 
1120
        """
 
1121
        if not self.is_locked():
 
1122
            raise AssertionError()
 
1123
        vf = self.revisions
 
1124
        if revisions_iterator is None:
 
1125
            revisions_iterator = self._iter_revisions(None)
 
1126
        for revid, revision in revisions_iterator:
 
1127
            if revision is None:
 
1128
                pass
 
1129
            parent_map = vf.get_parent_map([(revid,)])
 
1130
            parents_according_to_index = tuple(parent[-1] for parent in
 
1131
                parent_map[(revid,)])
 
1132
            parents_according_to_revision = tuple(revision.parent_ids)
 
1133
            if parents_according_to_index != parents_according_to_revision:
 
1134
                yield (revid, parents_according_to_index,
 
1135
                    parents_according_to_revision)
 
1136
 
 
1137
    def _check_for_inconsistent_revision_parents(self):
 
1138
        inconsistencies = list(self._find_inconsistent_revision_parents())
 
1139
        if inconsistencies:
 
1140
            raise errors.BzrCheckError(
 
1141
                "Revision index has inconsistent parents.")
 
1142
 
1112
1143
 
1113
1144
class GroupCHKStreamSource(StreamSource):
1114
1145
    """Used when both the source and target repo are GroupCHK repos."""