~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/annotate.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-07-09 00:44:25 UTC
  • mfrom: (4454.3.79 1.17-rework-annotate)
  • Revision ID: pqm@pqm.ubuntu.com-20090709004425-6tukiuklys5y02m5
(jam) Rework the internals of annotate to use a class object (fixes
        bug #387952)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2004, 2005, 2006, 2007 Canonical Ltd
 
1
# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
313
313
    return matcher.get_matching_blocks()
314
314
 
315
315
 
316
 
def _break_annotation_tie(annotated_lines):
 
316
_break_annotation_tie = None
 
317
 
 
318
def _old_break_annotation_tie(annotated_lines):
317
319
    """Chose an attribution between several possible ones.
318
320
 
319
321
    :param annotated_lines: A list of tuples ((file_id, rev_id), line) where
394
396
                        # If the result is not stable, there is a risk a
395
397
                        # performance degradation as criss-cross merges will
396
398
                        # flip-flop the attribution.
397
 
                        output_append(_break_annotation_tie([left, right]))
 
399
                        if _break_annotation_tie is None:
 
400
                            output_append(
 
401
                                _old_break_annotation_tie([left, right]))
 
402
                        else:
 
403
                            output_append(_break_annotation_tie([left, right]))
398
404
        last_child_idx = child_idx + match_len
399
405
 
400
406
 
444
450
        # If left and right agree on a range, just push that into the output
445
451
        lines_extend(annotated_lines[left_idx:left_idx + match_len])
446
452
    return lines
 
453
 
 
454
 
 
455
try:
 
456
    from bzrlib._annotator_pyx import Annotator
 
457
except ImportError:
 
458
    from bzrlib._annotator_py import Annotator