~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-06-06 22:59:58 UTC
  • mfrom: (1740.2.6 bzr.checkout)
  • Revision ID: pqm@pqm.ubuntu.com-20060606225958-17ab4431da6b44f6
Speed up checkout by using existing revision text when possible

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
635
646
                repository.get_transaction())
636
647
        if ie.revision not in w:
637
648
            text_parents = []
 
649
            # FIXME: TODO: The following loop *may* be overlapping/duplicate
 
650
            # with inventoryEntry.find_previous_heads(). if it is, then there
 
651
            # is a latent bug here where the parents may have ancestors of each
 
652
            # other. RBC, AB
638
653
            for revision, tree in parent_trees.iteritems():
639
654
                if ie.file_id not in tree:
640
655
                    continue