##// END OF EJS Templates
tests: unify test-diff-unified
Adrian Buehlmann -
r12141:5f44daa8 default
parent child Browse files
Show More
@@ -1,58 +1,109 b''
1 #!/bin/sh
1 $ hg init repo
2 $ cd repo
3 $ cat > a <<EOF
4 > c
5 > c
6 > a
7 > a
8 > b
9 > a
10 > a
11 > c
12 > c
13 > EOF
14 $ hg ci -Am adda
15 adding a
2 16
3 hg init repo
4 cd repo
5 cat > a <<EOF
6 c
7 c
8 a
9 a
10 b
11 a
12 a
13 c
14 c
15 EOF
16 hg ci -Am adda
17 cat > a <<EOF
18 c
19 c
20 a
21 a
22 dd
23 a
24 a
25 c
26 c
27 EOF
17 $ cat > a <<EOF
18 > c
19 > c
20 > a
21 > a
22 > dd
23 > a
24 > a
25 > c
26 > c
27 > EOF
28
29 default context
30
31 $ hg diff --nodates
32 diff -r cf9f4ba66af2 a
33 --- a/a
34 +++ b/a
35 @@ -2,7 +2,7 @@
36 c
37 a
38 a
39 -b
40 +dd
41 a
42 a
43 c
44
45 invalid --unified
46
47 $ hg diff --nodates -U foo
48 abort: diff context lines count must be an integer, not 'foo'
49
28 50
29 echo '% default context'
30 hg diff --nodates
31
32 echo '% invalid --unified'
33 hg diff --nodates -U foo
51 $ hg diff --nodates -U 2
52 diff -r cf9f4ba66af2 a
53 --- a/a
54 +++ b/a
55 @@ -3,5 +3,5 @@
56 a
57 a
58 -b
59 +dd
60 a
61 a
34 62
35 echo '% --unified=2'
36 hg diff --nodates -U 2
37
38 echo '% diff.unified=2'
39 hg --config diff.unified=2 diff --nodates
40
41 echo '% diff.unified=2 --unified=1'
42 hg diff --nodates -U 1
63 $ hg --config diff.unified=2 diff --nodates
64 diff -r cf9f4ba66af2 a
65 --- a/a
66 +++ b/a
67 @@ -3,5 +3,5 @@
68 a
69 a
70 -b
71 +dd
72 a
73 a
43 74
44 echo '% invalid diff.unified'
45 hg --config diff.unified=foo diff --nodates
75 $ hg diff --nodates -U 1
76 diff -r cf9f4ba66af2 a
77 --- a/a
78 +++ b/a
79 @@ -4,3 +4,3 @@
80 a
81 -b
82 +dd
83 a
84
85 invalid diff.unified
86
87 $ hg --config diff.unified=foo diff --nodates
88 abort: diff context lines count must be an integer, not 'foo'
89
90 test off-by-one error with diff -p
46 91
47 echo % test off-by-one error with diff -p
48 hg init diffp
49 cd diffp
50 echo a > a
51 hg ci -Ama
52 rm a
53 echo b > a
54 echo a >> a
55 echo c >> a
56 hg diff -U0 -p --nodates
92 $ hg init diffp
93 $ cd diffp
94 $ echo a > a
95 $ hg ci -Ama
96 adding a
97 $ rm a
98 $ echo b > a
99 $ echo a >> a
100 $ echo c >> a
101 $ hg diff -U0 -p --nodates
102 diff -r cb9a9f314b8b a
103 --- a/a
104 +++ b/a
105 @@ -1,0 +1,1 @@
106 +b
107 @@ -2,0 +3,1 @@ a
108 +c
57 109
58 exit 0
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now