mercurial/mdiff.py
changeset 3199 096f1c73cdc3
parent 3026 d838bfac668d
child 3877 abaee83ce0a6
child 4103 544838cc1158
equal deleted inserted replaced
3198:a32f65549b9e 3199:096f1c73cdc3
    22 class diffopts(object):
    22 class diffopts(object):
    23     '''context is the number of context lines
    23     '''context is the number of context lines
    24     text treats all files as text
    24     text treats all files as text
    25     showfunc enables diff -p output
    25     showfunc enables diff -p output
    26     git enables the git extended patch format
    26     git enables the git extended patch format
       
    27     nodates removes dates from diff headers
    27     ignorews ignores all whitespace changes in the diff
    28     ignorews ignores all whitespace changes in the diff
    28     ignorewsamount ignores changes in the amount of whitespace
    29     ignorewsamount ignores changes in the amount of whitespace
    29     ignoreblanklines ignores changes whose lines are all blank'''
    30     ignoreblanklines ignores changes whose lines are all blank'''
    30 
    31 
    31     defaults = {
    32     defaults = {
    32         'context': 3,
    33         'context': 3,
    33         'text': False,
    34         'text': False,
    34         'showfunc': True,
    35         'showfunc': True,
    35         'git': False,
    36         'git': False,
       
    37         'nodates': False,
    36         'ignorews': False,
    38         'ignorews': False,
    37         'ignorewsamount': False,
    39         'ignorewsamount': False,
    38         'ignoreblanklines': False,
    40         'ignoreblanklines': False,
    39         }
    41         }
    40 
    42 
    49 
    51 
    50 defaultopts = diffopts()
    52 defaultopts = diffopts()
    51 
    53 
    52 def unidiff(a, ad, b, bd, fn, r=None, opts=defaultopts):
    54 def unidiff(a, ad, b, bd, fn, r=None, opts=defaultopts):
    53     def datetag(date):
    55     def datetag(date):
    54         return opts.git and '\n' or '\t%s\n' % date
    56         return (opts.git or opts.nodates) and '\n' or '\t%s\n' % date
    55 
    57 
    56     if not a and not b: return ""
    58     if not a and not b: return ""
    57     epoch = util.datestr((0, 0))
    59     epoch = util.datestr((0, 0))
    58 
    60 
    59     if not opts.text and (util.binary(a) or util.binary(b)):
    61     if not opts.text and (util.binary(a) or util.binary(b)):