Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/mdiff.py @ 3192:096f1c73cdc3
Add -D/--nodates options to hg diff/export that removes dates from diff headers
and replace uses of sed in the tests with --nodates.
author | Stephen Darnell <stephen@darnell.plus.com> |
---|---|
date | Tue, 26 Sep 2006 00:05:24 +0100 |
parents | d838bfac668d |
children | abaee83ce0a6 544838cc1158 |
comparison
equal
deleted
inserted
replaced
3191:a32f65549b9e | 3192: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)): |