Rev 4471: Factor out the time when a text is finally annotated from the time it is initialized. in http://bazaar.launchpad.net/~jameinel/bzr/1.17-rework-annotate

John Arbash Meinel john at arbash-meinel.com
Thu Jun 18 21:09:05 BST 2009


At http://bazaar.launchpad.net/~jameinel/bzr/1.17-rework-annotate

------------------------------------------------------------
revno: 4471
revision-id: john at arbash-meinel.com-20090618200843-1gnawhm2x9ng8nyr
parent: john at arbash-meinel.com-20090618200647-1j5kz9so3ma8b7o8
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.17-rework-annotate
timestamp: Thu 2009-06-18 15:08:43 -0500
message:
  Factor out the time when a text is finally annotated from the time it is initialized.
  The main win is that we can start tracking num_children, etc.
-------------- next part --------------
=== modified file 'bzrlib/_annotator_py.py'
--- a/bzrlib/_annotator_py.py	2009-06-18 20:06:47 +0000
+++ b/bzrlib/_annotator_py.py	2009-06-18 20:08:43 +0000
@@ -141,8 +141,10 @@
         this_annotation = (key,)
         # Note: annotations will be mutated by calls to _update_from*
         annotations = [this_annotation] * num_lines
+        return this_annotation, annotations
+
+    def _cache_annotations(self, key, parent_keys, annotations):
         self._annotations_cache[key] = annotations
-        return this_annotation, annotations
 
     def annotate(self, key):
         """Return annotated fulltext for the given key."""
@@ -152,12 +154,12 @@
              annotations) = self._init_annotations(text_key, num_lines)
 
             parent_keys = self._parent_map[text_key]
-            if not parent_keys:
-                continue
-            self._update_from_one_parent(annotations, text, parent_keys[0])
-            for parent in parent_keys[1:]:
-                self._update_from_other_parents(annotations, text,
-                                                this_annotation, parent)
+            if parent_keys:
+                self._update_from_one_parent(annotations, text, parent_keys[0])
+                for parent in parent_keys[1:]:
+                    self._update_from_other_parents(annotations, text,
+                                                    this_annotation, parent)
+            self._cache_annotations(text_key, parent_keys, annotations)
         try:
             annotations = self._annotations_cache[key]
         except KeyError:



More information about the bazaar-commits mailing list