~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Andrew Bennetts
  • Date: 2009-10-02 05:43:41 UTC
  • mfrom: (4634.52.10 2.0)
  • mto: This revision was merged to the branch mainline in revision 4723.
  • Revision ID: andrew.bennetts@canonical.com-20091002054341-99yxpjenx8cagpxn
Merge lp:bzr/2.0 into lp:bzr, duplicating relevant NEWS entries for 2.1.0.

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])
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: