~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/knitrepo.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-10-12 03:57:26 UTC
  • mfrom: (2745.6.62 reconcile-check-heads)
  • Revision ID: pqm@pqm.ubuntu.com-20071012035726-d8e3stq343fqi0bz
(Andrew Bennetts, Aaron Bentley) Reconcile can fix bad parent references.

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
            _revision_store, control_store, text_store)
91
91
        self._commit_builder_class = _commit_builder_class
92
92
        self._serializer = _serializer
 
93
        self._reconcile_fixes_text_parents = True
93
94
 
94
95
    def _warn_if_deprecated(self):
95
96
        # This class isn't deprecated
240
241
    def _make_parents_provider(self):
241
242
        return _KnitParentsProvider(self._get_revision_vf())
242
243
 
 
244
    def _find_inconsistent_revision_parents(self):
 
245
        """Find revisions with different parent lists in the revision object
 
246
        and in the index graph.
 
247
 
 
248
        :returns: an iterator yielding tuples of (revison-id, parents-in-index,
 
249
            parents-in-revision).
 
250
        """
 
251
        vf = self._get_revision_vf()
 
252
        index_versions = vf.versions()
 
253
        for index_version in index_versions:
 
254
            parents_according_to_index = vf._index.get_parents_with_ghosts(
 
255
                index_version)
 
256
            revision = self._revision_store.get_revision(index_version,
 
257
                self.get_transaction())
 
258
            parents_according_to_revision = revision.parent_ids
 
259
            if parents_according_to_index != parents_according_to_revision:
 
260
                yield (index_version, parents_according_to_index,
 
261
                    parents_according_to_revision)
 
262
 
 
263
    def _check_for_inconsistent_revision_parents(self):
 
264
        inconsistencies = list(self._find_inconsistent_revision_parents())
 
265
        if inconsistencies:
 
266
            raise errors.BzrCheckError(
 
267
                "Revision knit has inconsistent parents.")
 
268
 
 
269
    def revision_graph_can_have_wrong_parents(self):
 
270
        # The revision.kndx could potentially claim a revision has a different
 
271
        # parent to the revision text.
 
272
        return True
 
273
 
243
274
 
244
275
class RepositoryFormatKnit(MetaDirRepositoryFormat):
245
276
    """Bzr repository knit format (generalized).