~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/annotate.py

  • Committer: John Arbash Meinel
  • Date: 2009-06-23 20:20:39 UTC
  • mto: This revision was merged to the branch mainline in revision 4522.
  • Revision ID: john@arbash-meinel.com-20090623202039-kr6mxu576z5vc4y5
Initial implementation of a Pyrex annotator.

Drops the time down to 8.6s down from 9.7s.
This implementation is basically just a copy of the python one, so I'm
a bit surprised to see that much of a win already.

Show diffs side-by-side

added added

removed removed

Lines of Context:
188
188
        # or something.
189
189
        last_revision = current_rev.revision_id
190
190
        # XXX: Partially Cloned from branch, uses the old_get_graph, eep.
191
 
        # XXX: The main difficulty is that we need to inject a single new node
192
 
        #      (current_rev) into the graph before it gets numbered, etc.
193
 
        #      Once KnownGraph gets an 'add_node()' function, we can use
194
 
        #      VF.get_known_graph_ancestry().
195
191
        graph = repository.get_graph()
196
192
        revision_graph = dict(((key, value) for key, value in
197
193
            graph.iter_ancestry(current_rev.parent_ids) if value is not None))
317
313
    return matcher.get_matching_blocks()
318
314
 
319
315
 
320
 
_break_annotation_tie = None
321
 
 
322
 
def _old_break_annotation_tie(annotated_lines):
 
316
def _break_annotation_tie(annotated_lines):
323
317
    """Chose an attribution between several possible ones.
324
318
 
325
319
    :param annotated_lines: A list of tuples ((file_id, rev_id), line) where
400
394
                        # If the result is not stable, there is a risk a
401
395
                        # performance degradation as criss-cross merges will
402
396
                        # flip-flop the attribution.
403
 
                        if _break_annotation_tie is None:
404
 
                            output_append(
405
 
                                _old_break_annotation_tie([left, right]))
406
 
                        else:
407
 
                            output_append(_break_annotation_tie([left, right]))
 
397
                        output_append(_break_annotation_tie([left, right]))
408
398
        last_child_idx = child_idx + match_len
409
399
 
410
400
 
458
448
 
459
449
try:
460
450
    from bzrlib._annotator_pyx import Annotator
461
 
except ImportError, e:
462
 
    osutils.failed_to_load_extension(e)
 
451
except ImportError:
463
452
    from bzrlib._annotator_py import Annotator