##// END OF EJS Templates
Add -D/--nodates options to hg diff/export that removes dates from diff headers...
Stephen Darnell -
r3199:096f1c73 default
parent child Browse files
Show More
@@ -2852,6 +2852,7 b' table = {'
2852 2852 ('p', 'show-function', None,
2853 2853 _('show which function each change is in')),
2854 2854 ('g', 'git', None, _('use git extended diff format')),
2855 ('D', 'nodates', None, _("don't include dates in diff headers")),
2855 2856 ('w', 'ignore-all-space', None,
2856 2857 _('ignore white space when comparing lines')),
2857 2858 ('b', 'ignore-space-change', None,
@@ -2865,6 +2866,7 b' table = {'
2865 2866 [('o', 'output', '', _('print output to file with formatted name')),
2866 2867 ('a', 'text', None, _('treat all files as text')),
2867 2868 ('g', 'git', None, _('use git extended diff format')),
2869 ('D', 'nodates', None, _("don't include dates in diff headers")),
2868 2870 ('', 'switch-parent', None, _('diff against the second parent'))],
2869 2871 _('hg export [-a] [-o OUTFILESPEC] REV...')),
2870 2872 "debugforget|forget":
@@ -24,6 +24,7 b' class diffopts(object):'
24 24 text treats all files as text
25 25 showfunc enables diff -p output
26 26 git enables the git extended patch format
27 nodates removes dates from diff headers
27 28 ignorews ignores all whitespace changes in the diff
28 29 ignorewsamount ignores changes in the amount of whitespace
29 30 ignoreblanklines ignores changes whose lines are all blank'''
@@ -33,6 +34,7 b' class diffopts(object):'
33 34 'text': False,
34 35 'showfunc': True,
35 36 'git': False,
37 'nodates': False,
36 38 'ignorews': False,
37 39 'ignorewsamount': False,
38 40 'ignoreblanklines': False,
@@ -51,7 +53,7 b' defaultopts = diffopts()'
51 53
52 54 def unidiff(a, ad, b, bd, fn, r=None, opts=defaultopts):
53 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 58 if not a and not b: return ""
57 59 epoch = util.datestr((0, 0))
@@ -291,6 +291,8 b' def diffopts(ui, opts={}):'
291 291 text=opts.get('text'),
292 292 git=(opts.get('git') or
293 293 ui.configbool('diff', 'git', None)),
294 nodates=(opts.get('nodates') or
295 ui.configbool('diff', 'nodates', None)),
294 296 showfunc=(opts.get('show_function') or
295 297 ui.configbool('diff', 'showfunc', None)),
296 298 ignorews=(opts.get('ignore_all_space') or
@@ -26,11 +26,9 b' writing tests:'
26 26
27 27 use commit -m "test" -u test -d "1000000 0"
28 28
29 - diff will show the current time
29 - diff and export may show the current time
30 30
31 use hg diff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
32 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
33 to strip dates
31 use -D/--nodates to strip the dates
34 32
35 33 - You can append your own hgrc settings to the file that the environment
36 34 variable HGRCPATH points to. This file is cleared before running a test.
@@ -3,8 +3,7 b''
3 3 # GNU diff is the reference for all of these results.
4 4
5 5 hgdiff() {
6 hg diff "$@" | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
7 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
6 hg diff --nodates "$@"
8 7 }
9 8
10 9 test_added_blank_lines() {
@@ -14,14 +14,11 b' echo 1 > alpha/one'
14 14 echo 2 > beta/two
15 15
16 16 echo EVERYTHING
17 hg diff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
18 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
17 hg diff --nodates
19 18
20 19 echo BETA ONLY
21 hg diff beta | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
22 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
20 hg diff --nodates beta
23 21
24 22 echo INSIDE BETA
25 23 cd beta
26 hg diff . | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
27 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
24 hg diff --nodates .
@@ -7,12 +7,9 b' hg ci -m "a" -d "1000000 0"'
7 7
8 8 echo 123 > b
9 9 hg add b
10 hg diff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
11 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
10 hg diff --nodates
12 11
13 hg diff -r tip | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
14 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
12 hg diff --nodates -r tip
15 13
16 14 echo foo > a
17 hg diff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
18 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
15 hg diff --nodates
@@ -8,26 +8,22 b" hg ci -Amstart -d '0 0'"
8 8 echo new > new
9 9 hg ci -Amnew -d '0 0'
10 10 echo '% new file'
11 hg diff --git -r 0 | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
12 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
11 hg diff --git -r 0
13 12
14 13 hg cp new copy
15 14 hg ci -mcopy -d '0 0'
16 15 echo '% copy'
17 hg diff --git -r 1:tip | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
18 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
16 hg diff --git -r 1:tip
19 17
20 18 hg mv copy rename
21 19 hg ci -mrename -d '0 0'
22 20 echo '% rename'
23 hg diff --git -r 2:tip | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
24 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
21 hg diff --git -r 2:tip
25 22
26 23 hg rm rename
27 24 hg ci -mdelete -d '0 0'
28 25 echo '% delete'
29 hg diff --git -r 3:tip | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
30 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
26 hg diff --git -r 3:tip
31 27
32 28 cat > src <<EOF
33 29 1
@@ -40,17 +36,14 b" hg ci -Amsrc -d '0 0'"
40 36 chmod +x src
41 37 hg ci -munexec -d '0 0'
42 38 echo '% chmod 644'
43 hg diff --git -r 5:tip | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
44 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
39 hg diff --git -r 5:tip
45 40
46 41 hg mv src dst
47 42 chmod -x dst
48 43 echo a >> dst
49 44 hg ci -mrenamemod -d '0 0'
50 45 echo '% rename+mod+chmod'
51 hg diff --git -r 6:tip | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
52 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
46 hg diff --git -r 6:tip
53 47
54 48 echo '% nonexistent in tip+chmod'
55 hg diff --git -r 5:6 | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
56 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
49 hg diff --git -r 5:6
@@ -179,6 +179,7 b' options:'
179 179 -a --text treat all files as text
180 180 -p --show-function show which function each change is in
181 181 -g --git use git extended diff format
182 -D --nodates don't include dates in diff headers
182 183 -w --ignore-all-space ignore white space when comparing lines
183 184 -b --ignore-space-change ignore changes in the amount of white space
184 185 -B --ignore-blank-lines ignore changes whose lines are all blank
@@ -27,8 +27,8 b' hg id'
27 27 hg update -C 0
28 28 echo "changed file1 different" >> file1
29 29 HGMERGE=merge hg update
30 hg diff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" -e "s/\(<<<<<<<\) .*/\1/" \
31 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" -e "s/\(>>>>>>>\) .*/\1/"
30 #hg diff --nodates | sed -e "s/\(<<<<<<<\) .*/\1/" -e "s/\(>>>>>>>\) .*/\1/"
31 hg diff --nodates | sed -e "s/\(<<<<<<<\|>>>>>>>\) .*/\1/"
32 32 hg status
33 33 hg id
34 34 hg revert --no-backup --all
@@ -13,8 +13,8 b' hg revert --all'
13 13 rm foo
14 14 hg remove --after
15 15 hg commit -m 2 -d "1000000 0"
16 hg export 0
17 hg export 1
16 hg export --nodates 0
17 hg export --nodates 1
18 18 hg log -p -r 0
19 19 hg log -p -r 1
20 20
@@ -10,8 +10,8 b' removing foo'
10 10 1
11 11
12 12 diff -r 000000000000 -r 8ba83d44753d foo
13 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
14 +++ b/foo Mon Jan 12 13:46:40 1970 +0000
13 --- /dev/null
14 +++ b/foo
15 15 @@ -0,0 +1,1 @@
16 16 +a
17 17 # HG changeset patch
@@ -22,8 +22,8 b' diff -r 000000000000 -r 8ba83d44753d foo'
22 22 2
23 23
24 24 diff -r 8ba83d44753d -r a1fce69c50d9 foo
25 --- a/foo Mon Jan 12 13:46:40 1970 +0000
26 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
25 --- a/foo
26 +++ /dev/null
27 27 @@ -1,1 +0,0 @@
28 28 -a
29 29 changeset: 0:8ba83d44753d
@@ -12,8 +12,7 b' hg clone . ../r2'
12 12 cd ../r2
13 13 hg up
14 14 echo abc > a
15 hg diff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
16 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
15 hg diff --nodates
17 16
18 17 cd ../r1
19 18 echo b > b
@@ -34,8 +33,7 b' hg parents'
34 33 hg --debug up
35 34 hg parents
36 35 hg -v history
37 hg diff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
38 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
36 hg diff --nodates
39 37
40 38 # create a second head
41 39 cd ../r1
@@ -53,8 +51,7 b' hg --debug up || echo failed'
53 51 hg --debug merge || echo failed
54 52 hg --debug merge -f
55 53 hg parents
56 hg diff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
57 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
54 hg diff --nodates
58 55
59 56 # test a local add
60 57 cd ..
General Comments 0
You need to be logged in to leave comments. Login now