~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/diff.py

  • Committer: Paul Nixon
  • Date: 2012-07-24 16:56:07 UTC
  • mto: This revision was merged to the branch mainline in revision 6547.
  • Revision ID: pauljnixon@gmail.com-20120724165607-g8jdb1wrwm3ad4rt
Changed "default_context_amount" to be "DEFAULT_CONTEXT_AMOUNT" to be
consistent with the other constant names.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
    )
50
50
from bzrlib.trace import mutter, note, warning
51
51
 
52
 
default_context_amount = 3
 
52
DEFAULT_CONTEXT_AMOUNT = 3
53
53
 
54
54
class AtTemplate(string.Template):
55
55
    """Templating class that uses @ instead of $."""
73
73
 
74
74
def internal_diff(old_filename, oldlines, new_filename, newlines, to_file,
75
75
                  allow_binary=False, sequence_matcher=None,
76
 
                  path_encoding='utf8', context_lines=default_context_amount):
 
76
                  path_encoding='utf8', context_lines=DEFAULT_CONTEXT_AMOUNT):
77
77
    # FIXME: difflib is wrong if there is no trailing newline.
78
78
    # The syntax used by patch seems to be "\ No newline at
79
79
    # end of file" following the last diff line from that
428
428
                    path_encoding='utf8',
429
429
                    using=None,
430
430
                    format_cls=None,
431
 
                    context=default_context_amount):
 
431
                    context=DEFAULT_CONTEXT_AMOUNT):
432
432
    """Show in text form the changes from one tree to another.
433
433
 
434
434
    :param to_file: The output stream.
442
442
    :param format_cls: Formatter class (DiffTree subclass)
443
443
    """
444
444
    if context is None:
445
 
        context = default_context_amount
 
445
        context = DEFAULT_CONTEXT_AMOUNT
446
446
    if format_cls is None:
447
447
        format_cls = DiffTree
448
448
    old_tree.lock_read()
622
622
 
623
623
    def __init__(self, old_tree, new_tree, to_file, path_encoding='utf-8', 
624
624
                 old_label='', new_label='', text_differ=internal_diff, 
625
 
                 context_lines=default_context_amount):
 
625
                 context_lines=DEFAULT_CONTEXT_AMOUNT):
626
626
        DiffPath.__init__(self, old_tree, new_tree, to_file, path_encoding)
627
627
        self.text_differ = text_differ
628
628
        self.old_label = old_label