/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/_annotator_py.py

  • Committer: John Arbash Meinel
  • Date: 2009-06-18 20:35:31 UTC
  • mto: This revision was merged to the branch mainline in revision 4522.
  • Revision ID: john@arbash-meinel.com-20090618203531-ak0yojd30oskp07r
Have _record_annotation start to remove texts when they are no longer needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
160
160
        annotations = [this_annotation] * num_lines
161
161
        return this_annotation, annotations
162
162
 
163
 
    def _cache_annotations(self, key, parent_keys, annotations):
 
163
    def _record_annotation(self, key, parent_keys, annotations):
164
164
        self._annotations_cache[key] = annotations
 
165
        for parent_key in parent_keys:
 
166
            num = self._num_needed_children[parent_key]
 
167
            num -= 1
 
168
            if num == 0:
 
169
                del self._text_cache[parent_key]
 
170
                # Do we want to clean up _num_needed_children at this point as
 
171
                # well?
 
172
            self._num_needed_children[parent_key] = num
165
173
 
166
174
    def annotate(self, key):
167
175
        """Return annotated fulltext for the given key."""
176
184
                for parent in parent_keys[1:]:
177
185
                    self._update_from_other_parents(annotations, text,
178
186
                                                    this_annotation, parent)
179
 
            self._cache_annotations(text_key, parent_keys, annotations)
 
187
            self._record_annotation(text_key, parent_keys, annotations)
180
188
        try:
181
189
            annotations = self._annotations_cache[key]
182
190
        except KeyError: