~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Andrew Bennetts
  • Date: 2009-08-10 08:10:06 UTC
  • mto: This revision was merged to the branch mainline in revision 4608.
  • Revision ID: andrew.bennetts@canonical.com-20090810081006-hsl2hvsh4awse3kl
Replace require_flags method with allow_versioned_root and allow_tree_references flags on InventoryDeltaSerializer.__init__, and shift some checking of delta compatibility from StreamSink to InventoryDeltaSerializer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4232
4232
            # Insert the delta directly
4233
4233
            inventory_delta_bytes = record.get_bytes_as('fulltext')
4234
4234
            deserialiser = inventory_delta.InventoryDeltaDeserializer()
4235
 
            parse_result = deserialiser.parse_text_bytes(inventory_delta_bytes)
 
4235
            try:
 
4236
                parse_result = deserialiser.parse_text_bytes(
 
4237
                    inventory_delta_bytes)
 
4238
            except inventory_delta._IncompatibleDelta, err:
 
4239
                trace.mutter("Incompatible delta: %s", err.msg)
 
4240
                raise errors.IncompatibleRevision(self.target_repo._format)
4236
4241
            basis_id, new_id, rich_root, tree_refs, inv_delta = parse_result
4237
 
            # Make sure the delta is compatible with the target
4238
 
            if rich_root and not target_rich_root:
4239
 
                raise errors.IncompatibleRevision(self.target_repo._format)
4240
 
            if tree_refs and not target_tree_refs:
4241
 
                # The source supports tree refs and the target doesn't.  Check
4242
 
                # the delta for tree refs; if it has any we can't insert it.
4243
 
                for delta_item in inv_delta:
4244
 
                    entry = delta_item[3]
4245
 
                    if entry.kind == 'tree-reference':
4246
 
                        raise errors.IncompatibleRevision(
4247
 
                            self.target_repo._format)
4248
4242
            revision_id = new_id
4249
4243
            parents = [key[0] for key in record.parents]
4250
4244
            self.target_repo.add_inventory_by_delta(