~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_annotator_py.py

  • Committer: John Arbash Meinel
  • Date: 2009-06-18 19:25:39 UTC
  • mto: This revision was merged to the branch mainline in revision 4522.
  • Revision ID: john@arbash-meinel.com-20090618192539-z18ym3jxutv1fpwx
A bit of simplification to the annotate_flat logic.

Show diffs side-by-side

added added

removed removed

Lines of Context:
162
162
        out = []
163
163
        graph = _mod_graph.KnownGraph(self._parent_map)
164
164
        heads = graph.heads
 
165
        append = out.append
165
166
        for annotation, line in zip(annotations, lines):
166
167
            if len(annotation) == 1:
167
 
                out.append((annotation[0], line))
 
168
                append((annotation[0], line))
168
169
            else:
169
170
                the_heads = heads(annotation)
170
171
                if len(the_heads) == 1:
171
172
                    for head in the_heads:
172
173
                        break
173
 
                    out.append((head, line))
174
174
                else:
175
175
                    # We need to resolve the ambiguity, for now just pick the
176
176
                    # sorted smallest
177
 
                    out.append((sorted(the_heads)[0], line))
 
177
                    head = sorted(the_heads)[0]
 
178
                append((head, line))
 
179
                last_ann = annotation
 
180
                last_head = head
178
181
        return out