/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

Merge bzr.dev

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
508
519
        # use inventory as it was in that revision
509
520
        file_id = tree.inventory.path2id(file)
510
521
        if not file_id:
511
 
            raise BzrError("%r is not present in revision %s" % (file, revno))
512
 
            try:
513
 
                revno = self.revision_id_to_revno(revision_id)
514
 
            except errors.NoSuchRevision:
515
 
                # TODO: This should not be BzrError,
516
 
                # but NoSuchFile doesn't fit either
517
 
                raise BzrError('%r is not present in revision %s' 
518
 
                                % (file, revision_id))
519
 
            else:
520
 
                raise BzrError('%r is not present in revision %s'
521
 
                                % (file, revno))
 
522
            # TODO: jam 20060427 Write a test for this code path
 
523
            #       it had a bug in it, and was raising the wrong
 
524
            #       exception.
 
525
            raise errors.BzrError("%r is not present in revision %s" % (file, revision_id))
522
526
        tree.print_file(file_id)
523
527
 
524
528
    def get_transaction(self):
635
639
                repository.get_transaction())
636
640
        if ie.revision not in w:
637
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
638
646
            for revision, tree in parent_trees.iteritems():
639
647
                if ie.file_id not in tree:
640
648
                    continue