~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/revisiontree.py

  • Committer: John Arbash Meinel
  • Date: 2008-07-11 21:41:24 UTC
  • mto: This revision was merged to the branch mainline in revision 3543.
  • Revision ID: john@arbash-meinel.com-20080711214124-qi09irlj7pd5cuzg
Shortcut the case when one revision is in the ancestry of the other.

At the cost of a heads() check, when one parent supersedes, we don't have to extract
the text for the other. Changes merge time from 3m37s => 3m21s. Using a
CachingParentsProvider would drop the time down to 3m11s.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
        self._repository = branch
43
43
        self._inventory = inv
44
44
        self._revision_id = revision_id
45
 
        self._rules_searcher = None
46
45
 
47
46
    def supports_tree_reference(self):
48
47
        return True
63
62
        """Return the revision id associated with this tree."""
64
63
        return self._revision_id
65
64
 
66
 
    def get_file_text(self, file_id, path=None):
 
65
    def get_file_lines(self, file_id):
 
66
        return osutils.split_lines(self.get_file_text(file_id))
 
67
 
 
68
    def get_file_text(self, file_id):
67
69
        return list(self.iter_files_bytes([(file_id, None)]))[0][1]
68
70
 
69
71
    def get_file(self, file_id, path=None):
200
202
            for dir in reversed(dirblock):
201
203
                if dir[2] == _directory:
202
204
                    pending.append(dir)
203
 
 
204
 
    def _get_rules_searcher(self, default_searcher):
205
 
        """See Tree._get_rules_searcher."""
206
 
        if self._rules_searcher is None:
207
 
            self._rules_searcher = super(RevisionTree,
208
 
                self)._get_rules_searcher(default_searcher)
209
 
        return self._rules_searcher