~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bundle/bundle_data.py

Extend BundleTree, avoid inventory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
576
576
            return None
577
577
        return new_path
578
578
 
 
579
    def get_root_id(self):
 
580
        return self.path2id('')
 
581
 
579
582
    def path2id(self, path):
580
583
        """Return the id of the file present at path in the target tree."""
581
584
        file_id = self._new_id.get(path)
586
589
            return None
587
590
        if old_path in self.deleted:
588
591
            return None
589
 
        if getattr(self.base_tree, 'path2id', None) is not None:
590
 
            return self.base_tree.path2id(old_path)
591
 
        else:
592
 
            return self.base_tree.inventory.path2id(old_path)
 
592
        return self.base_tree.path2id(old_path)
593
593
 
594
594
    def id2path(self, file_id):
595
595
        """Return the new path in the target tree of the file with id file_id"""
625
625
        """
626
626
        base_id = self.old_contents_id(file_id)
627
627
        if (base_id is not None and
628
 
            base_id != self.base_tree.inventory.root.file_id):
 
628
            base_id != self.base_tree.get_root_id()):
629
629
            patch_original = self.base_tree.get_file(base_id)
630
630
        else:
631
631
            patch_original = None
632
632
        file_patch = self.patches.get(self.id2path(file_id))
633
633
        if file_patch is None:
634
634
            if (patch_original is None and
635
 
                self.get_kind(file_id) == 'directory'):
 
635
                self.kind(file_id) == 'directory'):
636
636
                return StringIO()
637
637
            if patch_original is None:
638
638
                raise AssertionError("None: %s" % file_id)
651
651
        except KeyError:
652
652
            return self.base_tree.get_symlink_target(file_id)
653
653
 
654
 
    def get_kind(self, file_id):
 
654
    def kind(self, file_id):
655
655
        if file_id in self._kinds:
656
656
            return self._kinds[file_id]
657
 
        return self.base_tree.inventory[file_id].kind
 
657
        return self.base_tree.kind(file_id)
 
658
 
 
659
    def get_file_revision(self, file_id):
 
660
        path = self.id2path(file_id)
 
661
        if path in self._last_changed:
 
662
            return self._last_changed[path]
 
663
        else:
 
664
            return self.base_tree.get_file_revision(file_id)
658
665
 
659
666
    def is_executable(self, file_id):
660
667
        path = self.id2path(file_id)
661
668
        if path in self._executable:
662
669
            return self._executable[path]
663
670
        else:
664
 
            return self.base_tree.inventory[file_id].executable
 
671
            return self.base_tree.is_executable(file_id)
665
672
 
666
673
    def get_last_changed(self, file_id):
667
674
        path = self.id2path(file_id)
707
714
                parent_path = dirname(path)
708
715
                parent_id = self.path2id(parent_path)
709
716
 
710
 
            kind = self.get_kind(file_id)
 
717
            kind = self.kind(file_id)
711
718
            revision_id = self.get_last_changed(file_id)
712
719
 
713
720
            name = basename(path)