/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/bundle/bundle_data.py

Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
223
223
            if repository.has_revision(revision_id):
224
224
                testament = StrictTestament.from_revision(repository, 
225
225
                                                          revision_id)
226
 
                local_sha1 = testament.as_sha1()
 
226
                local_sha1 = self._testament_sha1_from_revision(repository,
 
227
                                                                revision_id)
227
228
                if sha1 != local_sha1:
228
229
                    raise BzrError('sha1 mismatch. For revision id {%s}' 
229
230
                            'local: %s, bundle: %s' % (revision_id, local_sha1, sha1))
281
282
        rev_info = self.get_revision_info(revision_id)
282
283
        assert rev.revision_id == rev_info.revision_id
283
284
        assert rev.revision_id == revision_id
284
 
        sha1 = StrictTestament(rev, inventory).as_sha1()
 
285
        sha1 = self._testament_sha1(rev, inventory)
285
286
        if sha1 != rev_info.sha1:
286
287
            raise TestamentMismatch(rev.revision_id, rev_info.sha1, sha1)
287
288
        if rev.revision_id in rev_to_sha1:
539
540
            return None
540
541
        if old_path in self.deleted:
541
542
            return None
542
 
        if hasattr(self.base_tree, 'path2id'):
 
543
        if getattr(self.base_tree, 'path2id', None) is not None:
543
544
            return self.base_tree.path2id(old_path)
544
545
        else:
545
546
            return self.base_tree.inventory.path2id(old_path)
577
578
                then be cached.
578
579
        """
579
580
        base_id = self.old_contents_id(file_id)
580
 
        if base_id is not None:
 
581
        if (base_id is not None and
 
582
            base_id != self.base_tree.inventory.root.file_id):
581
583
            patch_original = self.base_tree.get_file(base_id)
582
584
        else:
583
585
            patch_original = None
646
648
 
647
649
        assert self.base_tree is not None
648
650
        base_inv = self.base_tree.inventory
649
 
        root_id = base_inv.root.file_id
650
 
        try:
651
 
            # New inventories have a unique root_id
652
 
            inv = Inventory(root_id, self.revision_id)
653
 
        except TypeError:
654
 
            inv = Inventory(revision_id=self.revision_id)
655
 
        inv.root.revision = self.get_last_changed(root_id)
 
651
        inv = Inventory(None, self.revision_id)
656
652
 
657
653
        def add_entry(file_id):
658
654
            path = self.id2path(file_id)
659
655
            if path is None:
660
656
                return
661
 
            parent_path = dirname(path)
662
 
            if parent_path == u'':
663
 
                parent_id = root_id
 
657
            if path == '':
 
658
                parent_id = None
664
659
            else:
 
660
                parent_path = dirname(path)
665
661
                parent_id = self.path2id(parent_path)
666
662
 
667
663
            kind = self.get_kind(file_id)
688
684
 
689
685
        sorted_entries = self.sorted_path_id()
690
686
        for path, file_id in sorted_entries:
691
 
            if file_id == inv.root.file_id:
692
 
                continue
693
687
            add_entry(file_id)
694
688
 
695
689
        return inv