~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Robert Collins
  • Date: 2006-02-28 01:13:01 UTC
  • mto: (1587.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 1588.
  • Revision ID: robertc@robertcollins.net-20060228011301-df7ce3b80dfb37ba
Enforce repository consistency during 'fetch' operations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
270
270
        # revisions. For knits when they are introduced we will probably want
271
271
        # to ensure that caching write transactions are in use.
272
272
        inv = self.get_inventory_weave()
273
 
        weave_parents = inv.parent_names(revision_id)
274
 
        weave_names = inv.names()
275
 
        for parent_id in r.parent_ids:
 
273
        self._check_revision_parents(r, inv)
 
274
        return r
 
275
 
 
276
    def _check_revision_parents(self, revision, inventory):
 
277
        """Private to Repository and Fetch.
 
278
        
 
279
        This checks the parentage of revision in an inventory weave for 
 
280
        consistency and is only applicable to inventory-weave-for-ancestry
 
281
        using repository formats & fetchers.
 
282
        """
 
283
        weave_parents = inventory.parent_names(revision.revision_id)
 
284
        weave_names = inventory.names()
 
285
        for parent_id in revision.parent_ids:
276
286
            if parent_id in weave_names:
277
287
                # this parent must not be a ghost.
278
288
                if not parent_id in weave_parents:
279
289
                    # but it is a ghost
280
290
                    raise errors.CorruptRepository(self)
281
 
        return r
282
291
 
283
292
    @needs_read_lock
284
293
    def get_revision_sha1(self, revision_id):