~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Wouter van Heyst
  • Date: 2006-06-07 11:13:02 UTC
  • mfrom: (1747 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1752.
  • Revision ID: larstiq@larstiq.dyndns.org-20060607111302-bce5a90c86f0d764
[merge] bzr.dev 1747

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
 
65
65
        returns the sha1 of the serialized inventory.
66
66
        """
 
67
        assert inv.revision_id is None or inv.revision_id == revid, \
 
68
            "Mismatch between inventory revision" \
 
69
            " id and insertion revid (%r, %r)" % (inv.revision_id, revid)
67
70
        inv_text = bzrlib.xml5.serializer_v5.write_inventory_to_string(inv)
68
71
        inv_sha1 = bzrlib.osutils.sha_string(inv_text)
69
72
        inv_vf = self.control_weaves.get_weave('inventory',
359
362
    @needs_read_lock
360
363
    def get_inventory(self, revision_id):
361
364
        """Get Inventory object by hash."""
362
 
        xml = self.get_inventory_xml(revision_id)
 
365
        return self.deserialise_inventory(
 
366
            revision_id, self.get_inventory_xml(revision_id))
 
367
 
 
368
    def deserialise_inventory(self, revision_id, xml):
 
369
        """Transform the xml into an inventory object. 
 
370
 
 
371
        :param revision_id: The expected revision id of the inventory.
 
372
        :param xml: A serialised inventory.
 
373
        """
363
374
        return bzrlib.xml5.serializer_v5.read_inventory_from_string(xml)
364
375
 
365
376
    @needs_read_lock
628
639
                repository.get_transaction())
629
640
        if ie.revision not in w:
630
641
            text_parents = []
 
642
            # FIXME: TODO: The following loop *may* be overlapping/duplicate
 
643
            # with inventoryEntry.find_previous_heads(). if it is, then there
 
644
            # is a latent bug here where the parents may have ancestors of each
 
645
            # other. RBC, AB
631
646
            for revision, tree in parent_trees.iteritems():
632
647
                if ie.file_id not in tree:
633
648
                    continue