diff 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
line wrap: on
line diff
--- a/mercurial/mdiff.py
+++ b/mercurial/mdiff.py
@@ -24,6 +24,7 @@ class diffopts(object):
     text treats all files as text
     showfunc enables diff -p output
     git enables the git extended patch format
+    nodates removes dates from diff headers
     ignorews ignores all whitespace changes in the diff
     ignorewsamount ignores changes in the amount of whitespace
     ignoreblanklines ignores changes whose lines are all blank'''
@@ -33,6 +34,7 @@ class diffopts(object):
         'text': False,
         'showfunc': True,
         'git': False,
+        'nodates': False,
         'ignorews': False,
         'ignorewsamount': False,
         'ignoreblanklines': False,
@@ -51,7 +53,7 @@ defaultopts = diffopts()
 
 def unidiff(a, ad, b, bd, fn, r=None, opts=defaultopts):
     def datetag(date):
-        return opts.git and '\n' or '\t%s\n' % date
+        return (opts.git or opts.nodates) and '\n' or '\t%s\n' % date
 
     if not a and not b: return ""
     epoch = util.datestr((0, 0))