~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/annotate.py

  • Committer: Martin Pool
  • Date: 2009-07-10 08:18:28 UTC
  • mto: This revision was merged to the branch mainline in revision 4566.
  • Revision ID: mbp@sourcefrog.net-20090710081828-3zqukazl1b62m05h
Additional test for stacking from absolute URL

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Canonical Ltd
 
1
# Copyright (C) 2004, 2005, 2006, 2007 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
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
 
454
444
        # If left and right agree on a range, just push that into the output
455
445
        lines_extend(annotated_lines[left_idx:left_idx + match_len])
456
446
    return lines
457
 
 
458
 
 
459
 
try:
460
 
    from bzrlib._annotator_pyx import Annotator
461
 
except ImportError, e:
462
 
    osutils.failed_to_load_extension(e)
463
 
    from bzrlib._annotator_py import Annotator