##// END OF EJS Templates
tests: add diff color trailing whitespace test
Sune Foldager -
r38682:b07b691d default
parent child Browse files
Show More
@@ -1,393 +1,414 b''
1 Setup
1 Setup
2
2
3 $ cat <<EOF >> $HGRCPATH
3 $ cat <<EOF >> $HGRCPATH
4 > [ui]
4 > [ui]
5 > color = yes
5 > color = yes
6 > formatted = always
6 > formatted = always
7 > paginate = never
7 > paginate = never
8 > [color]
8 > [color]
9 > mode = ansi
9 > mode = ansi
10 > EOF
10 > EOF
11 $ hg init repo
11 $ hg init repo
12 $ cd repo
12 $ cd repo
13 $ cat > a <<EOF
13 $ cat > a <<EOF
14 > c
14 > c
15 > c
15 > c
16 > a
16 > a
17 > a
17 > a
18 > b
18 > b
19 > a
19 > a
20 > a
20 > a
21 > c
21 > c
22 > c
22 > c
23 > EOF
23 > EOF
24 $ hg ci -Am adda
24 $ hg ci -Am adda
25 adding a
25 adding a
26 $ cat > a <<EOF
26 $ cat > a <<EOF
27 > c
27 > c
28 > c
28 > c
29 > a
29 > a
30 > a
30 > a
31 > dd
31 > dd
32 > a
32 > a
33 > a
33 > a
34 > c
34 > c
35 > c
35 > c
36 > EOF
36 > EOF
37
37
38 default context
38 default context
39
39
40 $ hg diff --nodates
40 $ hg diff --nodates
41 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
41 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
42 \x1b[0;31;1m--- a/a\x1b[0m (esc)
42 \x1b[0;31;1m--- a/a\x1b[0m (esc)
43 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
43 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
44 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
44 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
45 c
45 c
46 a
46 a
47 a
47 a
48 \x1b[0;31m-b\x1b[0m (esc)
48 \x1b[0;31m-b\x1b[0m (esc)
49 \x1b[0;32m+dd\x1b[0m (esc)
49 \x1b[0;32m+dd\x1b[0m (esc)
50 a
50 a
51 a
51 a
52 c
52 c
53
53
54 trailing whitespace
55
56 $ cp a a.orig
57 $ sed 's/^dd$/dd \r/' a >a.new
58 $ mv a.new a
59 $ hg diff --nodates
60 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
61 \x1b[0;31;1m--- a/a\x1b[0m (esc)
62 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
63 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
64 c
65 a
66 a
67 \x1b[0;31m-b\x1b[0m (esc)
68 \x1b[0;32m+dd\x1b[0m\x1b[0;1;41m \x1b[0m\r (esc)
69 a
70 a
71 c
72
73 $ mv a.orig a
74
54 (check that 'ui.color=yes' match '--color=auto')
75 (check that 'ui.color=yes' match '--color=auto')
55
76
56 $ hg diff --nodates --config ui.formatted=no
77 $ hg diff --nodates --config ui.formatted=no
57 diff -r cf9f4ba66af2 a
78 diff -r cf9f4ba66af2 a
58 --- a/a
79 --- a/a
59 +++ b/a
80 +++ b/a
60 @@ -2,7 +2,7 @@
81 @@ -2,7 +2,7 @@
61 c
82 c
62 a
83 a
63 a
84 a
64 -b
85 -b
65 +dd
86 +dd
66 a
87 a
67 a
88 a
68 c
89 c
69
90
70 (check that 'ui.color=no' disable color)
91 (check that 'ui.color=no' disable color)
71
92
72 $ hg diff --nodates --config ui.formatted=yes --config ui.color=no
93 $ hg diff --nodates --config ui.formatted=yes --config ui.color=no
73 diff -r cf9f4ba66af2 a
94 diff -r cf9f4ba66af2 a
74 --- a/a
95 --- a/a
75 +++ b/a
96 +++ b/a
76 @@ -2,7 +2,7 @@
97 @@ -2,7 +2,7 @@
77 c
98 c
78 a
99 a
79 a
100 a
80 -b
101 -b
81 +dd
102 +dd
82 a
103 a
83 a
104 a
84 c
105 c
85
106
86 (check that 'ui.color=always' force color)
107 (check that 'ui.color=always' force color)
87
108
88 $ hg diff --nodates --config ui.formatted=no --config ui.color=always
109 $ hg diff --nodates --config ui.formatted=no --config ui.color=always
89 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
110 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
90 \x1b[0;31;1m--- a/a\x1b[0m (esc)
111 \x1b[0;31;1m--- a/a\x1b[0m (esc)
91 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
112 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
92 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
113 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
93 c
114 c
94 a
115 a
95 a
116 a
96 \x1b[0;31m-b\x1b[0m (esc)
117 \x1b[0;31m-b\x1b[0m (esc)
97 \x1b[0;32m+dd\x1b[0m (esc)
118 \x1b[0;32m+dd\x1b[0m (esc)
98 a
119 a
99 a
120 a
100 c
121 c
101
122
102 --unified=2
123 --unified=2
103
124
104 $ hg diff --nodates -U 2
125 $ hg diff --nodates -U 2
105 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
126 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
106 \x1b[0;31;1m--- a/a\x1b[0m (esc)
127 \x1b[0;31;1m--- a/a\x1b[0m (esc)
107 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
128 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
108 \x1b[0;35m@@ -3,5 +3,5 @@\x1b[0m (esc)
129 \x1b[0;35m@@ -3,5 +3,5 @@\x1b[0m (esc)
109 a
130 a
110 a
131 a
111 \x1b[0;31m-b\x1b[0m (esc)
132 \x1b[0;31m-b\x1b[0m (esc)
112 \x1b[0;32m+dd\x1b[0m (esc)
133 \x1b[0;32m+dd\x1b[0m (esc)
113 a
134 a
114 a
135 a
115
136
116 diffstat
137 diffstat
117
138
118 $ hg diff --stat
139 $ hg diff --stat
119 a | 2 \x1b[0;32m+\x1b[0m\x1b[0;31m-\x1b[0m (esc)
140 a | 2 \x1b[0;32m+\x1b[0m\x1b[0;31m-\x1b[0m (esc)
120 1 files changed, 1 insertions(+), 1 deletions(-)
141 1 files changed, 1 insertions(+), 1 deletions(-)
121 $ cat <<EOF >> $HGRCPATH
142 $ cat <<EOF >> $HGRCPATH
122 > [extensions]
143 > [extensions]
123 > record =
144 > record =
124 > [ui]
145 > [ui]
125 > interactive = true
146 > interactive = true
126 > [diff]
147 > [diff]
127 > git = True
148 > git = True
128 > EOF
149 > EOF
129
150
130 #if execbit
151 #if execbit
131
152
132 record
153 record
133
154
134 $ chmod +x a
155 $ chmod +x a
135 $ hg record -m moda a <<EOF
156 $ hg record -m moda a <<EOF
136 > y
157 > y
137 > y
158 > y
138 > EOF
159 > EOF
139 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
160 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
140 \x1b[0;36;1mold mode 100644\x1b[0m (esc)
161 \x1b[0;36;1mold mode 100644\x1b[0m (esc)
141 \x1b[0;36;1mnew mode 100755\x1b[0m (esc)
162 \x1b[0;36;1mnew mode 100755\x1b[0m (esc)
142 1 hunks, 1 lines changed
163 1 hunks, 1 lines changed
143 \x1b[0;33mexamine changes to 'a'? [Ynesfdaq?]\x1b[0m y (esc)
164 \x1b[0;33mexamine changes to 'a'? [Ynesfdaq?]\x1b[0m y (esc)
144
165
145 \x1b[0;35m@@ -2,7 +2,7 @@ c\x1b[0m (esc)
166 \x1b[0;35m@@ -2,7 +2,7 @@ c\x1b[0m (esc)
146 c
167 c
147 a
168 a
148 a
169 a
149 \x1b[0;31m-b\x1b[0m (esc)
170 \x1b[0;31m-b\x1b[0m (esc)
150 \x1b[0;32m+dd\x1b[0m (esc)
171 \x1b[0;32m+dd\x1b[0m (esc)
151 a
172 a
152 a
173 a
153 c
174 c
154 \x1b[0;33mrecord this change to 'a'? [Ynesfdaq?]\x1b[0m y (esc)
175 \x1b[0;33mrecord this change to 'a'? [Ynesfdaq?]\x1b[0m y (esc)
155
176
156
177
157 $ echo "[extensions]" >> $HGRCPATH
178 $ echo "[extensions]" >> $HGRCPATH
158 $ echo "mq=" >> $HGRCPATH
179 $ echo "mq=" >> $HGRCPATH
159 $ hg rollback
180 $ hg rollback
160 repository tip rolled back to revision 0 (undo commit)
181 repository tip rolled back to revision 0 (undo commit)
161 working directory now based on revision 0
182 working directory now based on revision 0
162
183
163 qrecord
184 qrecord
164
185
165 $ hg qrecord -m moda patch <<EOF
186 $ hg qrecord -m moda patch <<EOF
166 > y
187 > y
167 > y
188 > y
168 > EOF
189 > EOF
169 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
190 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
170 \x1b[0;36;1mold mode 100644\x1b[0m (esc)
191 \x1b[0;36;1mold mode 100644\x1b[0m (esc)
171 \x1b[0;36;1mnew mode 100755\x1b[0m (esc)
192 \x1b[0;36;1mnew mode 100755\x1b[0m (esc)
172 1 hunks, 1 lines changed
193 1 hunks, 1 lines changed
173 \x1b[0;33mexamine changes to 'a'? [Ynesfdaq?]\x1b[0m y (esc)
194 \x1b[0;33mexamine changes to 'a'? [Ynesfdaq?]\x1b[0m y (esc)
174
195
175 \x1b[0;35m@@ -2,7 +2,7 @@ c\x1b[0m (esc)
196 \x1b[0;35m@@ -2,7 +2,7 @@ c\x1b[0m (esc)
176 c
197 c
177 a
198 a
178 a
199 a
179 \x1b[0;31m-b\x1b[0m (esc)
200 \x1b[0;31m-b\x1b[0m (esc)
180 \x1b[0;32m+dd\x1b[0m (esc)
201 \x1b[0;32m+dd\x1b[0m (esc)
181 a
202 a
182 a
203 a
183 c
204 c
184 \x1b[0;33mrecord this change to 'a'? [Ynesfdaq?]\x1b[0m y (esc)
205 \x1b[0;33mrecord this change to 'a'? [Ynesfdaq?]\x1b[0m y (esc)
185
206
186
207
187 $ hg qpop -a
208 $ hg qpop -a
188 popping patch
209 popping patch
189 patch queue now empty
210 patch queue now empty
190
211
191 #endif
212 #endif
192
213
193 issue3712: test colorization of subrepo diff
214 issue3712: test colorization of subrepo diff
194
215
195 $ hg init sub
216 $ hg init sub
196 $ echo b > sub/b
217 $ echo b > sub/b
197 $ hg -R sub commit -Am 'create sub'
218 $ hg -R sub commit -Am 'create sub'
198 adding b
219 adding b
199 $ echo 'sub = sub' > .hgsub
220 $ echo 'sub = sub' > .hgsub
200 $ hg add .hgsub
221 $ hg add .hgsub
201 $ hg commit -m 'add subrepo sub'
222 $ hg commit -m 'add subrepo sub'
202 $ echo aa >> a
223 $ echo aa >> a
203 $ echo bb >> sub/b
224 $ echo bb >> sub/b
204
225
205 $ hg diff -S
226 $ hg diff -S
206 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
227 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
207 \x1b[0;31;1m--- a/a\x1b[0m (esc)
228 \x1b[0;31;1m--- a/a\x1b[0m (esc)
208 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
229 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
209 \x1b[0;35m@@ -7,3 +7,4 @@\x1b[0m (esc)
230 \x1b[0;35m@@ -7,3 +7,4 @@\x1b[0m (esc)
210 a
231 a
211 c
232 c
212 c
233 c
213 \x1b[0;32m+aa\x1b[0m (esc)
234 \x1b[0;32m+aa\x1b[0m (esc)
214 \x1b[0;1mdiff --git a/sub/b b/sub/b\x1b[0m (esc)
235 \x1b[0;1mdiff --git a/sub/b b/sub/b\x1b[0m (esc)
215 \x1b[0;31;1m--- a/sub/b\x1b[0m (esc)
236 \x1b[0;31;1m--- a/sub/b\x1b[0m (esc)
216 \x1b[0;32;1m+++ b/sub/b\x1b[0m (esc)
237 \x1b[0;32;1m+++ b/sub/b\x1b[0m (esc)
217 \x1b[0;35m@@ -1,1 +1,2 @@\x1b[0m (esc)
238 \x1b[0;35m@@ -1,1 +1,2 @@\x1b[0m (esc)
218 b
239 b
219 \x1b[0;32m+bb\x1b[0m (esc)
240 \x1b[0;32m+bb\x1b[0m (esc)
220
241
221 test tabs
242 test tabs
222
243
223 $ cat >> a <<EOF
244 $ cat >> a <<EOF
224 > one tab
245 > one tab
225 > two tabs
246 > two tabs
226 > end tab
247 > end tab
227 > mid tab
248 > mid tab
228 > all tabs
249 > all tabs
229 > EOF
250 > EOF
230 $ hg diff --nodates
251 $ hg diff --nodates
231 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
252 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
232 \x1b[0;31;1m--- a/a\x1b[0m (esc)
253 \x1b[0;31;1m--- a/a\x1b[0m (esc)
233 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
254 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
234 \x1b[0;35m@@ -7,3 +7,9 @@\x1b[0m (esc)
255 \x1b[0;35m@@ -7,3 +7,9 @@\x1b[0m (esc)
235 a
256 a
236 c
257 c
237 c
258 c
238 \x1b[0;32m+aa\x1b[0m (esc)
259 \x1b[0;32m+aa\x1b[0m (esc)
239 \x1b[0;32m+\x1b[0m \x1b[0;32mone tab\x1b[0m (esc)
260 \x1b[0;32m+\x1b[0m \x1b[0;32mone tab\x1b[0m (esc)
240 \x1b[0;32m+\x1b[0m \x1b[0;32mtwo tabs\x1b[0m (esc)
261 \x1b[0;32m+\x1b[0m \x1b[0;32mtwo tabs\x1b[0m (esc)
241 \x1b[0;32m+end tab\x1b[0m\x1b[0;1;41m \x1b[0m (esc)
262 \x1b[0;32m+end tab\x1b[0m\x1b[0;1;41m \x1b[0m (esc)
242 \x1b[0;32m+mid\x1b[0m \x1b[0;32mtab\x1b[0m (esc)
263 \x1b[0;32m+mid\x1b[0m \x1b[0;32mtab\x1b[0m (esc)
243 \x1b[0;32m+\x1b[0m \x1b[0;32mall\x1b[0m \x1b[0;32mtabs\x1b[0m\x1b[0;1;41m \x1b[0m (esc)
264 \x1b[0;32m+\x1b[0m \x1b[0;32mall\x1b[0m \x1b[0;32mtabs\x1b[0m\x1b[0;1;41m \x1b[0m (esc)
244 $ echo "[color]" >> $HGRCPATH
265 $ echo "[color]" >> $HGRCPATH
245 $ echo "diff.tab = bold magenta" >> $HGRCPATH
266 $ echo "diff.tab = bold magenta" >> $HGRCPATH
246 $ hg diff --nodates
267 $ hg diff --nodates
247 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
268 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
248 \x1b[0;31;1m--- a/a\x1b[0m (esc)
269 \x1b[0;31;1m--- a/a\x1b[0m (esc)
249 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
270 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
250 \x1b[0;35m@@ -7,3 +7,9 @@\x1b[0m (esc)
271 \x1b[0;35m@@ -7,3 +7,9 @@\x1b[0m (esc)
251 a
272 a
252 c
273 c
253 c
274 c
254 \x1b[0;32m+aa\x1b[0m (esc)
275 \x1b[0;32m+aa\x1b[0m (esc)
255 \x1b[0;32m+\x1b[0m\x1b[0;1;35m \x1b[0m\x1b[0;32mone tab\x1b[0m (esc)
276 \x1b[0;32m+\x1b[0m\x1b[0;1;35m \x1b[0m\x1b[0;32mone tab\x1b[0m (esc)
256 \x1b[0;32m+\x1b[0m\x1b[0;1;35m \x1b[0m\x1b[0;32mtwo tabs\x1b[0m (esc)
277 \x1b[0;32m+\x1b[0m\x1b[0;1;35m \x1b[0m\x1b[0;32mtwo tabs\x1b[0m (esc)
257 \x1b[0;32m+end tab\x1b[0m\x1b[0;1;41m \x1b[0m (esc)
278 \x1b[0;32m+end tab\x1b[0m\x1b[0;1;41m \x1b[0m (esc)
258 \x1b[0;32m+mid\x1b[0m\x1b[0;1;35m \x1b[0m\x1b[0;32mtab\x1b[0m (esc)
279 \x1b[0;32m+mid\x1b[0m\x1b[0;1;35m \x1b[0m\x1b[0;32mtab\x1b[0m (esc)
259 \x1b[0;32m+\x1b[0m\x1b[0;1;35m \x1b[0m\x1b[0;32mall\x1b[0m\x1b[0;1;35m \x1b[0m\x1b[0;32mtabs\x1b[0m\x1b[0;1;41m \x1b[0m (esc)
280 \x1b[0;32m+\x1b[0m\x1b[0;1;35m \x1b[0m\x1b[0;32mall\x1b[0m\x1b[0;1;35m \x1b[0m\x1b[0;32mtabs\x1b[0m\x1b[0;1;41m \x1b[0m (esc)
260
281
261 $ cd ..
282 $ cd ..
262
283
263 test inline color diff
284 test inline color diff
264
285
265 $ hg init inline
286 $ hg init inline
266 $ cd inline
287 $ cd inline
267 $ cat > file1 << EOF
288 $ cat > file1 << EOF
268 > this is the first line
289 > this is the first line
269 > this is the second line
290 > this is the second line
270 > third line starts with space
291 > third line starts with space
271 > + starts with a plus sign
292 > + starts with a plus sign
272 > this one with one tab
293 > this one with one tab
273 > now with full two tabs
294 > now with full two tabs
274 > now tabs everywhere, much fun
295 > now tabs everywhere, much fun
275 >
296 >
276 > this line won't change
297 > this line won't change
277 >
298 >
278 > two lines are going to
299 > two lines are going to
279 > be changed into three!
300 > be changed into three!
280 >
301 >
281 > three of those lines will
302 > three of those lines will
282 > collapse onto one
303 > collapse onto one
283 > (to see if it works)
304 > (to see if it works)
284 > EOF
305 > EOF
285 $ hg add file1
306 $ hg add file1
286 $ hg ci -m 'commit'
307 $ hg ci -m 'commit'
287
308
288 $ cat > file1 << EOF
309 $ cat > file1 << EOF
289 > that is the first paragraph
310 > that is the first paragraph
290 > this is the second line
311 > this is the second line
291 > third line starts with space
312 > third line starts with space
292 > - starts with a minus sign
313 > - starts with a minus sign
293 > this one with two tab
314 > this one with two tab
294 > now with full three tabs
315 > now with full three tabs
295 > now there are tabs everywhere, much fun
316 > now there are tabs everywhere, much fun
296 >
317 >
297 > this line won't change
318 > this line won't change
298 >
319 >
299 > two lines are going to
320 > two lines are going to
300 > (entirely magically,
321 > (entirely magically,
301 > assuming this works)
322 > assuming this works)
302 > be changed into four!
323 > be changed into four!
303 >
324 >
304 > three of those lines have
325 > three of those lines have
305 > collapsed onto one
326 > collapsed onto one
306 > EOF
327 > EOF
307 $ hg diff --config diff.word-diff=False --color=debug
328 $ hg diff --config diff.word-diff=False --color=debug
308 [diff.diffline|diff --git a/file1 b/file1]
329 [diff.diffline|diff --git a/file1 b/file1]
309 [diff.file_a|--- a/file1]
330 [diff.file_a|--- a/file1]
310 [diff.file_b|+++ b/file1]
331 [diff.file_b|+++ b/file1]
311 [diff.hunk|@@ -1,16 +1,17 @@]
332 [diff.hunk|@@ -1,16 +1,17 @@]
312 [diff.deleted|-this is the first line]
333 [diff.deleted|-this is the first line]
313 [diff.deleted|-this is the second line]
334 [diff.deleted|-this is the second line]
314 [diff.deleted|- third line starts with space]
335 [diff.deleted|- third line starts with space]
315 [diff.deleted|-+ starts with a plus sign]
336 [diff.deleted|-+ starts with a plus sign]
316 [diff.deleted|-][diff.tab| ][diff.deleted|this one with one tab]
337 [diff.deleted|-][diff.tab| ][diff.deleted|this one with one tab]
317 [diff.deleted|-][diff.tab| ][diff.deleted|now with full two tabs]
338 [diff.deleted|-][diff.tab| ][diff.deleted|now with full two tabs]
318 [diff.deleted|-][diff.tab| ][diff.deleted|now tabs][diff.tab| ][diff.deleted|everywhere, much fun]
339 [diff.deleted|-][diff.tab| ][diff.deleted|now tabs][diff.tab| ][diff.deleted|everywhere, much fun]
319 [diff.inserted|+that is the first paragraph]
340 [diff.inserted|+that is the first paragraph]
320 [diff.inserted|+ this is the second line]
341 [diff.inserted|+ this is the second line]
321 [diff.inserted|+third line starts with space]
342 [diff.inserted|+third line starts with space]
322 [diff.inserted|+- starts with a minus sign]
343 [diff.inserted|+- starts with a minus sign]
323 [diff.inserted|+][diff.tab| ][diff.inserted|this one with two tab]
344 [diff.inserted|+][diff.tab| ][diff.inserted|this one with two tab]
324 [diff.inserted|+][diff.tab| ][diff.inserted|now with full three tabs]
345 [diff.inserted|+][diff.tab| ][diff.inserted|now with full three tabs]
325 [diff.inserted|+][diff.tab| ][diff.inserted|now there are tabs][diff.tab| ][diff.inserted|everywhere, much fun]
346 [diff.inserted|+][diff.tab| ][diff.inserted|now there are tabs][diff.tab| ][diff.inserted|everywhere, much fun]
326
347
327 this line won't change
348 this line won't change
328
349
329 two lines are going to
350 two lines are going to
330 [diff.deleted|-be changed into three!]
351 [diff.deleted|-be changed into three!]
331 [diff.inserted|+(entirely magically,]
352 [diff.inserted|+(entirely magically,]
332 [diff.inserted|+ assuming this works)]
353 [diff.inserted|+ assuming this works)]
333 [diff.inserted|+be changed into four!]
354 [diff.inserted|+be changed into four!]
334
355
335 [diff.deleted|-three of those lines will]
356 [diff.deleted|-three of those lines will]
336 [diff.deleted|-collapse onto one]
357 [diff.deleted|-collapse onto one]
337 [diff.deleted|-(to see if it works)]
358 [diff.deleted|-(to see if it works)]
338 [diff.inserted|+three of those lines have]
359 [diff.inserted|+three of those lines have]
339 [diff.inserted|+collapsed onto one]
360 [diff.inserted|+collapsed onto one]
340 $ hg diff --config diff.word-diff=True --color=debug
361 $ hg diff --config diff.word-diff=True --color=debug
341 [diff.diffline|diff --git a/file1 b/file1]
362 [diff.diffline|diff --git a/file1 b/file1]
342 [diff.file_a|--- a/file1]
363 [diff.file_a|--- a/file1]
343 [diff.file_b|+++ b/file1]
364 [diff.file_b|+++ b/file1]
344 [diff.hunk|@@ -1,16 +1,17 @@]
365 [diff.hunk|@@ -1,16 +1,17 @@]
345 [diff.deleted|-][diff.deleted.changed|this][diff.deleted.unchanged| is the first ][diff.deleted.changed|line]
366 [diff.deleted|-][diff.deleted.changed|this][diff.deleted.unchanged| is the first ][diff.deleted.changed|line]
346 [diff.deleted|-][diff.deleted.unchanged|this is the second line]
367 [diff.deleted|-][diff.deleted.unchanged|this is the second line]
347 [diff.deleted|-][diff.deleted.changed| ][diff.deleted.unchanged|third line starts with space]
368 [diff.deleted|-][diff.deleted.changed| ][diff.deleted.unchanged|third line starts with space]
348 [diff.deleted|-][diff.deleted.changed|+][diff.deleted.unchanged| starts with a ][diff.deleted.changed|plus][diff.deleted.unchanged| sign]
369 [diff.deleted|-][diff.deleted.changed|+][diff.deleted.unchanged| starts with a ][diff.deleted.changed|plus][diff.deleted.unchanged| sign]
349 [diff.deleted|-][diff.tab| ][diff.deleted.unchanged|this one with ][diff.deleted.changed|one][diff.deleted.unchanged| tab]
370 [diff.deleted|-][diff.tab| ][diff.deleted.unchanged|this one with ][diff.deleted.changed|one][diff.deleted.unchanged| tab]
350 [diff.deleted|-][diff.tab| ][diff.deleted.unchanged|now with full ][diff.deleted.changed|two][diff.deleted.unchanged| tabs]
371 [diff.deleted|-][diff.tab| ][diff.deleted.unchanged|now with full ][diff.deleted.changed|two][diff.deleted.unchanged| tabs]
351 [diff.deleted|-][diff.tab| ][diff.deleted.unchanged|now ][diff.deleted.unchanged|tabs][diff.tab| ][diff.deleted.unchanged|everywhere, much fun]
372 [diff.deleted|-][diff.tab| ][diff.deleted.unchanged|now ][diff.deleted.unchanged|tabs][diff.tab| ][diff.deleted.unchanged|everywhere, much fun]
352 [diff.inserted|+][diff.inserted.changed|that][diff.inserted.unchanged| is the first ][diff.inserted.changed|paragraph]
373 [diff.inserted|+][diff.inserted.changed|that][diff.inserted.unchanged| is the first ][diff.inserted.changed|paragraph]
353 [diff.inserted|+][diff.inserted.changed| ][diff.inserted.unchanged|this is the second line]
374 [diff.inserted|+][diff.inserted.changed| ][diff.inserted.unchanged|this is the second line]
354 [diff.inserted|+][diff.inserted.unchanged|third line starts with space]
375 [diff.inserted|+][diff.inserted.unchanged|third line starts with space]
355 [diff.inserted|+][diff.inserted.changed|-][diff.inserted.unchanged| starts with a ][diff.inserted.changed|minus][diff.inserted.unchanged| sign]
376 [diff.inserted|+][diff.inserted.changed|-][diff.inserted.unchanged| starts with a ][diff.inserted.changed|minus][diff.inserted.unchanged| sign]
356 [diff.inserted|+][diff.tab| ][diff.inserted.unchanged|this one with ][diff.inserted.changed|two][diff.inserted.unchanged| tab]
377 [diff.inserted|+][diff.tab| ][diff.inserted.unchanged|this one with ][diff.inserted.changed|two][diff.inserted.unchanged| tab]
357 [diff.inserted|+][diff.tab| ][diff.inserted.unchanged|now with full ][diff.inserted.changed|three][diff.inserted.unchanged| tabs]
378 [diff.inserted|+][diff.tab| ][diff.inserted.unchanged|now with full ][diff.inserted.changed|three][diff.inserted.unchanged| tabs]
358 [diff.inserted|+][diff.tab| ][diff.inserted.unchanged|now ][diff.inserted.changed|there are ][diff.inserted.unchanged|tabs][diff.tab| ][diff.inserted.unchanged|everywhere, much fun]
379 [diff.inserted|+][diff.tab| ][diff.inserted.unchanged|now ][diff.inserted.changed|there are ][diff.inserted.unchanged|tabs][diff.tab| ][diff.inserted.unchanged|everywhere, much fun]
359
380
360 this line won't change
381 this line won't change
361
382
362 two lines are going to
383 two lines are going to
363 [diff.deleted|-][diff.deleted.unchanged|be changed into ][diff.deleted.changed|three][diff.deleted.unchanged|!]
384 [diff.deleted|-][diff.deleted.unchanged|be changed into ][diff.deleted.changed|three][diff.deleted.unchanged|!]
364 [diff.inserted|+][diff.inserted.changed|(entirely magically,]
385 [diff.inserted|+][diff.inserted.changed|(entirely magically,]
365 [diff.inserted|+][diff.inserted.changed| assuming this works)]
386 [diff.inserted|+][diff.inserted.changed| assuming this works)]
366 [diff.inserted|+][diff.inserted.unchanged|be changed into ][diff.inserted.changed|four][diff.inserted.unchanged|!]
387 [diff.inserted|+][diff.inserted.unchanged|be changed into ][diff.inserted.changed|four][diff.inserted.unchanged|!]
367
388
368 [diff.deleted|-][diff.deleted.unchanged|three of those lines ][diff.deleted.changed|will]
389 [diff.deleted|-][diff.deleted.unchanged|three of those lines ][diff.deleted.changed|will]
369 [diff.deleted|-][diff.deleted.changed|collapse][diff.deleted.unchanged| onto one]
390 [diff.deleted|-][diff.deleted.changed|collapse][diff.deleted.unchanged| onto one]
370 [diff.deleted|-][diff.deleted.changed|(to see if it works)]
391 [diff.deleted|-][diff.deleted.changed|(to see if it works)]
371 [diff.inserted|+][diff.inserted.unchanged|three of those lines ][diff.inserted.changed|have]
392 [diff.inserted|+][diff.inserted.unchanged|three of those lines ][diff.inserted.changed|have]
372 [diff.inserted|+][diff.inserted.changed|collapsed][diff.inserted.unchanged| onto one]
393 [diff.inserted|+][diff.inserted.changed|collapsed][diff.inserted.unchanged| onto one]
373
394
374 multibyte character shouldn't be broken up in word diff:
395 multibyte character shouldn't be broken up in word diff:
375
396
376 $ $PYTHON <<'EOF'
397 $ $PYTHON <<'EOF'
377 > with open("utf8", "wb") as f:
398 > with open("utf8", "wb") as f:
378 > f.write(b"blah \xe3\x82\xa2 blah\n")
399 > f.write(b"blah \xe3\x82\xa2 blah\n")
379 > EOF
400 > EOF
380 $ hg ci -Am 'add utf8 char' utf8
401 $ hg ci -Am 'add utf8 char' utf8
381 $ $PYTHON <<'EOF'
402 $ $PYTHON <<'EOF'
382 > with open("utf8", "wb") as f:
403 > with open("utf8", "wb") as f:
383 > f.write(b"blah \xe3\x82\xa4 blah\n")
404 > f.write(b"blah \xe3\x82\xa4 blah\n")
384 > EOF
405 > EOF
385 $ hg ci -m 'slightly change utf8 char' utf8
406 $ hg ci -m 'slightly change utf8 char' utf8
386
407
387 $ hg diff --config diff.word-diff=True --color=debug -c.
408 $ hg diff --config diff.word-diff=True --color=debug -c.
388 [diff.diffline|diff --git a/utf8 b/utf8]
409 [diff.diffline|diff --git a/utf8 b/utf8]
389 [diff.file_a|--- a/utf8]
410 [diff.file_a|--- a/utf8]
390 [diff.file_b|+++ b/utf8]
411 [diff.file_b|+++ b/utf8]
391 [diff.hunk|@@ -1,1 +1,1 @@]
412 [diff.hunk|@@ -1,1 +1,1 @@]
392 [diff.deleted|-][diff.deleted.unchanged|blah ][diff.deleted.changed|\xe3\x82\xa2][diff.deleted.unchanged| blah] (esc)
413 [diff.deleted|-][diff.deleted.unchanged|blah ][diff.deleted.changed|\xe3\x82\xa2][diff.deleted.unchanged| blah] (esc)
393 [diff.inserted|+][diff.inserted.unchanged|blah ][diff.inserted.changed|\xe3\x82\xa4][diff.inserted.unchanged| blah] (esc)
414 [diff.inserted|+][diff.inserted.unchanged|blah ][diff.inserted.changed|\xe3\x82\xa4][diff.inserted.unchanged| blah] (esc)
General Comments 0
You need to be logged in to leave comments. Login now