~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

MergeĀ lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
859
859
    def get_preview_tree(self):
860
860
        """Return a tree representing the result of the transform.
861
861
 
862
 
        This tree only supports the subset of Tree functionality required
863
 
        by show_diff_trees.  It must only be compared to tt._tree.
 
862
        The tree is a snapshot, and altering the TreeTransform will invalidate
 
863
        it.
864
864
        """
865
865
        return _PreviewTree(self)
866
866
 
1635
1635
        self._all_children_cache = {}
1636
1636
        self._path2trans_id_cache = {}
1637
1637
        self._final_name_cache = {}
1638
 
 
1639
 
    def _changes(self, file_id):
1640
 
        for changes in self._transform.iter_changes():
1641
 
            if changes[0] == file_id:
1642
 
                return changes
 
1638
        self._iter_changes_cache = dict((c[0], c) for c in
 
1639
                                        self._transform.iter_changes())
1643
1640
 
1644
1641
    def _content_change(self, file_id):
1645
1642
        """Return True if the content of this file changed"""
1646
 
        changes = self._changes(file_id)
 
1643
        changes = self._iter_changes_cache.get(file_id)
1647
1644
        # changes[2] is true if the file content changed.  See
1648
1645
        # InterTree.iter_changes.
1649
1646
        return (changes is not None and changes[2])
1884
1881
    def get_file_mtime(self, file_id, path=None):
1885
1882
        """See Tree.get_file_mtime"""
1886
1883
        if not self._content_change(file_id):
1887
 
            return self._transform._tree.get_file_mtime(file_id, path)
 
1884
            return self._transform._tree.get_file_mtime(file_id)
1888
1885
        return self._stat_limbo_file(file_id).st_mtime
1889
1886
 
1890
1887
    def _file_size(self, entry, stat_value):
1990
1987
 
1991
1988
    def annotate_iter(self, file_id,
1992
1989
                      default_revision=_mod_revision.CURRENT_REVISION):
1993
 
        changes = self._changes(file_id)
 
1990
        changes = self._iter_changes_cache.get(file_id)
1994
1991
        if changes is None:
1995
1992
            get_old = True
1996
1993
        else: