~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/knitrepo.py

  • Committer: Andrew Bennetts
  • Date: 2007-10-05 00:52:37 UTC
  • mfrom: (2819.2.5 find-inconsistent-parents)
  • mto: This revision was merged to the branch mainline in revision 2905.
  • Revision ID: andrew.bennetts@canonical.com-20071005005237-rlgbshfgenspobfd
MergeĀ find-inconsistent-parents.

Show diffs side-by-side

added added

removed removed

Lines of Context:
237
237
    def _make_parents_provider(self):
238
238
        return _KnitParentsProvider(self._get_revision_vf())
239
239
 
 
240
    def _find_inconsistent_revision_parents(self):
 
241
        """Find revisions with different parent lists in the revision object
 
242
        and in the index graph.
 
243
 
 
244
        :returns: an iterator yielding tuples of (revison-id, parents-in-index,
 
245
            parents-in-revision).
 
246
        """
 
247
        vf = self._get_revision_vf()
 
248
        index_versions = vf.versions()
 
249
        for index_version in index_versions:
 
250
            parents_according_to_index = vf._index.get_parents_with_ghosts(
 
251
                index_version)
 
252
            revision = self._revision_store.get_revision(index_version,
 
253
                self.get_transaction())
 
254
            parents_according_to_revision = revision.parent_ids
 
255
            if parents_according_to_index != parents_according_to_revision:
 
256
                yield (index_version, parents_according_to_index,
 
257
                    parents_according_to_revision)
 
258
 
 
259
    def _check_for_inconsistent_revision_parents(self):
 
260
        inconsistencies = list(self._find_inconsistent_revision_parents())
 
261
        if inconsistencies:
 
262
            raise errors.BzrCheckError(
 
263
                "Revision knit has inconsistent parents.")
 
264
 
 
265
    def revision_graph_can_have_wrong_parents(self):
 
266
        # The revision.kndx could potentially claim a revision has a different
 
267
        # parent to the revision text.
 
268
        return True
 
269
 
240
270
 
241
271
class KnitRepository3(KnitRepository):
242
272