~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: 2011-04-16 01:09:56 UTC
  • mfrom: (5784.1.4 760435-less-fail)
  • Revision ID: pqm@pqm.ubuntu.com-20110416010956-5wrpm136qq2hz5f3
(mbp) rename and deprecate failUnlessExists and failIfExists (Martin Pool)

Show diffs side-by-side

added added

removed removed

Lines of Context:
232
232
    def _make_parents_provider(self):
233
233
        return _KnitsParentsProvider(self.revisions)
234
234
 
 
235
    def _find_inconsistent_revision_parents(self, revisions_iterator=None):
 
236
        """Find revisions with different parent lists in the revision object
 
237
        and in the index graph.
 
238
 
 
239
        :param revisions_iterator: None, or an iterator of (revid,
 
240
            Revision-or-None). This iterator controls the revisions checked.
 
241
        :returns: an iterator yielding tuples of (revison-id, parents-in-index,
 
242
            parents-in-revision).
 
243
        """
 
244
        if not self.is_locked():
 
245
            raise AssertionError()
 
246
        vf = self.revisions
 
247
        if revisions_iterator is None:
 
248
            revisions_iterator = self._iter_revisions(None)
 
249
        for revid, revision in revisions_iterator:
 
250
            if revision is None:
 
251
                pass
 
252
            parent_map = vf.get_parent_map([(revid,)])
 
253
            parents_according_to_index = tuple(parent[-1] for parent in
 
254
                parent_map[(revid,)])
 
255
            parents_according_to_revision = tuple(revision.parent_ids)
 
256
            if parents_according_to_index != parents_according_to_revision:
 
257
                yield (revid, parents_according_to_index,
 
258
                    parents_according_to_revision)
 
259
 
 
260
    def _check_for_inconsistent_revision_parents(self):
 
261
        inconsistencies = list(self._find_inconsistent_revision_parents())
 
262
        if inconsistencies:
 
263
            raise errors.BzrCheckError(
 
264
                "Revision knit has inconsistent parents.")
 
265
 
235
266
 
236
267
class RepositoryFormatKnit(MetaDirRepositoryFormat):
237
268
    """Bzr repository knit format (generalized).