Rev 4467: A bit of simplification to the annotate_flat logic. in http://bazaar.launchpad.net/~jameinel/bzr/1.17-rework-annotate

John Arbash Meinel john at arbash-meinel.com
Thu Jun 18 20:25:59 BST 2009


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

------------------------------------------------------------
revno: 4467
revision-id: john at arbash-meinel.com-20090618192539-z18ym3jxutv1fpwx
parent: john at arbash-meinel.com-20090618190050-npw99yywixsccaok
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.17-rework-annotate
timestamp: Thu 2009-06-18 14:25:39 -0500
message:
  A bit of simplification to the annotate_flat logic.
-------------- next part --------------
=== modified file 'bzrlib/_annotator_py.py'
--- a/bzrlib/_annotator_py.py	2009-06-18 19:00:50 +0000
+++ b/bzrlib/_annotator_py.py	2009-06-18 19:25:39 +0000
@@ -162,17 +162,20 @@
         out = []
         graph = _mod_graph.KnownGraph(self._parent_map)
         heads = graph.heads
+        append = out.append
         for annotation, line in zip(annotations, lines):
             if len(annotation) == 1:
-                out.append((annotation[0], line))
+                append((annotation[0], line))
             else:
                 the_heads = heads(annotation)
                 if len(the_heads) == 1:
                     for head in the_heads:
                         break
-                    out.append((head, line))
                 else:
                     # We need to resolve the ambiguity, for now just pick the
                     # sorted smallest
-                    out.append((sorted(the_heads)[0], line))
+                    head = sorted(the_heads)[0]
+                append((head, line))
+                last_ann = annotation
+                last_head = head
         return out



More information about the bazaar-commits mailing list