~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/groupcompress_repo.py

  • Committer: Jelmer Vernooij
  • Date: 2011-04-05 16:26:48 UTC
  • mto: (5757.7.2 knitpackrepo-6)
  • mto: This revision was merged to the branch mainline in revision 5790.
  • Revision ID: jelmer@samba.org-20110405162648-qr4xw3jdvopmkxva
Don't make PackRepository derive from KnitRepository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
605
605
    def __init__(self, *args, **kwargs):
606
606
        super(GCCHKCanonicalizingPacker, self).__init__(*args, **kwargs)
607
607
        self._data_changed = False
608
 
    
 
608
 
609
609
    def _exhaust_stream(self, source_vf, keys, message, vf_to_stream, pb_offset):
610
610
        """Create and exhaust a stream, but don't insert it.
611
 
        
 
611
 
612
612
        This is useful to get the side-effects of generating a stream.
613
613
        """
614
614
        self.pb.update('scanning %s' % (message,), pb_offset)
1147
1147
            return GroupCHKStreamSource(self, to_format)
1148
1148
        return super(CHKInventoryRepository, self)._get_source(to_format)
1149
1149
 
 
1150
    def _find_inconsistent_revision_parents(self, revisions_iterator=None):
 
1151
        """Find revisions with different parent lists in the revision object
 
1152
        and in the index graph.
 
1153
 
 
1154
        :param revisions_iterator: None, or an iterator of (revid,
 
1155
            Revision-or-None). This iterator controls the revisions checked.
 
1156
        :returns: an iterator yielding tuples of (revison-id, parents-in-index,
 
1157
            parents-in-revision).
 
1158
        """
 
1159
        if not self.is_locked():
 
1160
            raise AssertionError()
 
1161
        vf = self.revisions
 
1162
        if revisions_iterator is None:
 
1163
            revisions_iterator = self._iter_revisions(None)
 
1164
        for revid, revision in revisions_iterator:
 
1165
            if revision is None:
 
1166
                pass
 
1167
            parent_map = vf.get_parent_map([(revid,)])
 
1168
            parents_according_to_index = tuple(parent[-1] for parent in
 
1169
                parent_map[(revid,)])
 
1170
            parents_according_to_revision = tuple(revision.parent_ids)
 
1171
            if parents_according_to_index != parents_according_to_revision:
 
1172
                yield (revid, parents_according_to_index,
 
1173
                    parents_according_to_revision)
 
1174
 
 
1175
    def _check_for_inconsistent_revision_parents(self):
 
1176
        inconsistencies = list(self._find_inconsistent_revision_parents())
 
1177
        if inconsistencies:
 
1178
            raise errors.BzrCheckError(
 
1179
                "Revision index has inconsistent parents.")
 
1180
 
 
1181
    def revision_graph_can_have_wrong_parents(self):
 
1182
        return True
 
1183
 
1150
1184
 
1151
1185
class GroupCHKStreamSource(StreamSource):
1152
1186
    """Used when both the source and target repo are GroupCHK repos."""