Show More
@@ -1,414 +1,415 b'' | |||
|
1 | 1 | $ echo "[extensions]" >> $HGRCPATH |
|
2 | 2 | $ echo "extdiff=" >> $HGRCPATH |
|
3 | 3 | |
|
4 | 4 | $ hg init a |
|
5 | 5 | $ cd a |
|
6 | 6 | $ echo a > a |
|
7 | 7 | $ echo b > b |
|
8 | 8 | $ hg add |
|
9 | 9 | adding a |
|
10 | 10 | adding b |
|
11 | 11 | |
|
12 | 12 | Should diff cloned directories: |
|
13 | 13 | |
|
14 | 14 | $ hg extdiff -o -r $opt |
|
15 | 15 | Only in a: a |
|
16 | 16 | Only in a: b |
|
17 | 17 | [1] |
|
18 | 18 | |
|
19 | 19 | $ cat <<EOF >> $HGRCPATH |
|
20 | 20 | > [extdiff] |
|
21 | 21 | > cmd.falabala = echo |
|
22 | 22 | > opts.falabala = diffing |
|
23 | 23 | > cmd.edspace = echo |
|
24 | 24 | > opts.edspace = "name <user@example.com>" |
|
25 | 25 | > EOF |
|
26 | 26 | |
|
27 | 27 | $ hg falabala |
|
28 | 28 | diffing a.000000000000 a |
|
29 | 29 | [1] |
|
30 | 30 | |
|
31 | 31 | $ hg help falabala |
|
32 | 32 | hg falabala [OPTION]... [FILE]... |
|
33 | 33 | |
|
34 | 34 | use external program to diff repository (or selected files) |
|
35 | 35 | |
|
36 | 36 | Show differences between revisions for the specified files, using the |
|
37 | 37 | following program: |
|
38 | 38 | |
|
39 | 39 | 'echo' |
|
40 | 40 | |
|
41 | 41 | When two revision arguments are given, then changes are shown between |
|
42 | 42 | those revisions. If only one revision is specified then that revision is |
|
43 | 43 | compared to the working directory, and, when no revisions are specified, |
|
44 | 44 | the working directory files are compared to its parent. |
|
45 | 45 | |
|
46 | 46 | options ([+] can be repeated): |
|
47 | 47 | |
|
48 | 48 | -o --option OPT [+] pass option to comparison program |
|
49 | 49 | -r --rev REV [+] revision |
|
50 | 50 | -c --change REV change made by revision |
|
51 | 51 | --patch compare patches for two revisions |
|
52 | 52 | -I --include PATTERN [+] include names matching the given patterns |
|
53 | 53 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
54 | 54 | -S --subrepos recurse into subrepositories |
|
55 | 55 | |
|
56 | 56 | (some details hidden, use --verbose to show complete help) |
|
57 | 57 | |
|
58 | 58 | $ hg ci -d '0 0' -mtest1 |
|
59 | 59 | |
|
60 | 60 | $ echo b >> a |
|
61 | 61 | $ hg ci -d '1 0' -mtest2 |
|
62 | 62 | |
|
63 | 63 | Should diff cloned files directly: |
|
64 | 64 | |
|
65 | 65 | #if windows |
|
66 | 66 | $ hg falabala -r 0:1 |
|
67 | 67 | diffing "*\\extdiff.*\\a.8a5febb7f867\\a" "a.34eed99112ab\\a" (glob) |
|
68 | 68 | [1] |
|
69 | 69 | #else |
|
70 | 70 | $ hg falabala -r 0:1 |
|
71 | 71 | diffing */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob) |
|
72 | 72 | [1] |
|
73 | 73 | #endif |
|
74 | 74 | |
|
75 | 75 | Specifying an empty revision should abort. |
|
76 | 76 | |
|
77 | 77 | $ hg extdiff -p diff --patch --rev 'ancestor()' --rev 1 |
|
78 | 78 | abort: empty revision on one side of range |
|
79 | 79 | [255] |
|
80 | 80 | |
|
81 | 81 | Test diff during merge: |
|
82 | 82 | |
|
83 | 83 | $ hg update -C 0 |
|
84 | 84 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
85 | 85 | $ echo c >> c |
|
86 | 86 | $ hg add c |
|
87 | 87 | $ hg ci -m "new branch" -d '1 0' |
|
88 | 88 | created new head |
|
89 | 89 | $ hg merge 1 |
|
90 | 90 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
91 | 91 | (branch merge, don't forget to commit) |
|
92 | 92 | |
|
93 | 93 | Should diff cloned file against wc file: |
|
94 | 94 | |
|
95 | 95 | #if windows |
|
96 | 96 | $ hg falabala |
|
97 | 97 | diffing "*\\extdiff.*\\a.2a13a4d2da36\\a" "*\\a\\a" (glob) |
|
98 | 98 | [1] |
|
99 | 99 | #else |
|
100 | 100 | $ hg falabala |
|
101 | 101 | diffing */extdiff.*/a.2a13a4d2da36/a */a/a (glob) |
|
102 | 102 | [1] |
|
103 | 103 | #endif |
|
104 | 104 | |
|
105 | 105 | |
|
106 | 106 | Test --change option: |
|
107 | 107 | |
|
108 | 108 | $ hg ci -d '2 0' -mtest3 |
|
109 | 109 | #if windows |
|
110 | 110 | $ hg falabala -c 1 |
|
111 | 111 | diffing "*\\extdiff.*\\a.8a5febb7f867\\a" "a.34eed99112ab\\a" (glob) |
|
112 | 112 | [1] |
|
113 | 113 | #else |
|
114 | 114 | $ hg falabala -c 1 |
|
115 | 115 | diffing */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob) |
|
116 | 116 | [1] |
|
117 | 117 | #endif |
|
118 | 118 | |
|
119 | 119 | Check diff are made from the first parent: |
|
120 | 120 | |
|
121 | 121 | #if windows |
|
122 | 122 | $ hg falabala -c 3 || echo "diff-like tools yield a non-zero exit code" |
|
123 | 123 | diffing "*\\extdiff.*\\a.2a13a4d2da36\\a" "a.46c0e4daeb72\\a" (glob) |
|
124 | 124 | diff-like tools yield a non-zero exit code |
|
125 | 125 | #else |
|
126 | 126 | $ hg falabala -c 3 || echo "diff-like tools yield a non-zero exit code" |
|
127 | 127 | diffing */extdiff.*/a.2a13a4d2da36/a a.46c0e4daeb72/a (glob) |
|
128 | 128 | diff-like tools yield a non-zero exit code |
|
129 | 129 | #endif |
|
130 | 130 | |
|
131 | 131 | issue3153: ensure using extdiff with removed subrepos doesn't crash: |
|
132 | 132 | |
|
133 | 133 | $ hg init suba |
|
134 | 134 | $ cd suba |
|
135 | 135 | $ echo suba > suba |
|
136 | 136 | $ hg add |
|
137 | 137 | adding suba |
|
138 | 138 | $ hg ci -m "adding suba file" |
|
139 | 139 | $ cd .. |
|
140 | 140 | $ echo suba=suba > .hgsub |
|
141 | 141 | $ hg add |
|
142 | 142 | adding .hgsub |
|
143 | 143 | $ hg ci -Sm "adding subrepo" |
|
144 | 144 | $ echo > .hgsub |
|
145 | 145 | $ hg ci -m "removing subrepo" |
|
146 | 146 | $ hg falabala -r 4 -r 5 -S |
|
147 | 147 | diffing a.398e36faf9c6 a.5ab95fb166c4 |
|
148 | 148 | [1] |
|
149 | 149 | |
|
150 | 150 | issue4463: usage of command line configuration without additional quoting |
|
151 | 151 | |
|
152 | 152 | $ cat <<EOF >> $HGRCPATH |
|
153 | 153 | > [extdiff] |
|
154 | 154 | > cmd.4463a = echo |
|
155 | 155 | > opts.4463a = a-naked 'single quoted' "double quoted" |
|
156 | 156 | > 4463b = echo b-naked 'single quoted' "double quoted" |
|
157 | 157 | > echo = |
|
158 | 158 | > EOF |
|
159 | 159 | $ hg update -q -C 0 |
|
160 | 160 | $ echo a >> a |
|
161 | 161 | #if windows |
|
162 | 162 | $ hg --debug 4463a | grep '^running' |
|
163 | 163 | running 'echo a-naked \'single quoted\' "double quoted" "*\\a" "*\\a"' in */extdiff.* (glob) |
|
164 | 164 | $ hg --debug 4463b | grep '^running' |
|
165 | 165 | running 'echo b-naked \'single quoted\' "double quoted" "*\\a" "*\\a"' in */extdiff.* (glob) |
|
166 | 166 | $ hg --debug echo | grep '^running' |
|
167 | 167 | running '*echo* "*\\a" "*\\a"' in */extdiff.* (glob) |
|
168 | 168 | #else |
|
169 | 169 | $ hg --debug 4463a | grep '^running' |
|
170 | 170 | running 'echo a-naked \'single quoted\' "double quoted" */a $TESTTMP/a/a' in */extdiff.* (glob) |
|
171 | 171 | $ hg --debug 4463b | grep '^running' |
|
172 | 172 | running 'echo b-naked \'single quoted\' "double quoted" */a $TESTTMP/a/a' in */extdiff.* (glob) |
|
173 | 173 | $ hg --debug echo | grep '^running' |
|
174 | 174 | running '*echo */a $TESTTMP/a/a' in */extdiff.* (glob) |
|
175 | 175 | #endif |
|
176 | 176 | |
|
177 | 177 | (getting options from other than extdiff section) |
|
178 | 178 | |
|
179 | 179 | $ cat <<EOF >> $HGRCPATH |
|
180 | 180 | > [extdiff] |
|
181 | 181 | > # using diff-tools diffargs |
|
182 | 182 | > 4463b2 = echo |
|
183 | 183 | > # using merge-tools diffargs |
|
184 | 184 | > 4463b3 = echo |
|
185 | 185 | > # no diffargs |
|
186 | 186 | > 4463b4 = echo |
|
187 | 187 | > [diff-tools] |
|
188 | 188 | > 4463b2.diffargs = b2-naked 'single quoted' "double quoted" |
|
189 | 189 | > [merge-tools] |
|
190 | 190 | > 4463b3.diffargs = b3-naked 'single quoted' "double quoted" |
|
191 | 191 | > EOF |
|
192 | 192 | #if windows |
|
193 | 193 | $ hg --debug 4463b2 | grep '^running' |
|
194 | 194 | running 'echo b2-naked \'single quoted\' "double quoted" "*\\a" "*\\a"' in */extdiff.* (glob) |
|
195 | 195 | $ hg --debug 4463b3 | grep '^running' |
|
196 | 196 | running 'echo b3-naked \'single quoted\' "double quoted" "*\\a" "*\\a"' in */extdiff.* (glob) |
|
197 | 197 | $ hg --debug 4463b4 | grep '^running' |
|
198 | 198 | running 'echo "*\\a" "*\\a"' in */extdiff.* (glob) |
|
199 | 199 | $ hg --debug 4463b4 --option b4-naked --option 'being quoted' | grep '^running' |
|
200 | 200 | running 'echo b4-naked "being quoted" "*\\a" "*\\a"' in */extdiff.* (glob) |
|
201 | 201 | $ hg --debug extdiff -p echo --option echo-naked --option 'being quoted' | grep '^running' |
|
202 | 202 | running 'echo echo-naked "being quoted" "*\\a" "*\\a"' in */extdiff.* (glob) |
|
203 | 203 | #else |
|
204 | 204 | $ hg --debug 4463b2 | grep '^running' |
|
205 | 205 | running 'echo b2-naked \'single quoted\' "double quoted" */a $TESTTMP/a/a' in */extdiff.* (glob) |
|
206 | 206 | $ hg --debug 4463b3 | grep '^running' |
|
207 | 207 | running 'echo b3-naked \'single quoted\' "double quoted" */a $TESTTMP/a/a' in */extdiff.* (glob) |
|
208 | 208 | $ hg --debug 4463b4 | grep '^running' |
|
209 | 209 | running 'echo */a $TESTTMP/a/a' in */extdiff.* (glob) |
|
210 | 210 | $ hg --debug 4463b4 --option b4-naked --option 'being quoted' | grep '^running' |
|
211 | 211 | running "echo b4-naked 'being quoted' */a $TESTTMP/a/a" in */extdiff.* (glob) |
|
212 | 212 | $ hg --debug extdiff -p echo --option echo-naked --option 'being quoted' | grep '^running' |
|
213 | 213 | running "echo echo-naked 'being quoted' */a $TESTTMP/a/a" in */extdiff.* (glob) |
|
214 | 214 | #endif |
|
215 | 215 | |
|
216 | 216 | $ touch 'sp ace' |
|
217 | 217 | $ hg add 'sp ace' |
|
218 | 218 | $ hg ci -m 'sp ace' |
|
219 | 219 | created new head |
|
220 | 220 | $ echo > 'sp ace' |
|
221 | 221 | |
|
222 | 222 | Test pre-72a89cf86fcd backward compatibility with half-baked manual quoting |
|
223 | 223 | |
|
224 | 224 | $ cat <<EOF >> $HGRCPATH |
|
225 | 225 | > [extdiff] |
|
226 | 226 | > odd = |
|
227 | 227 | > [merge-tools] |
|
228 | 228 | > odd.diffargs = --foo='\$clabel' '\$clabel' "--bar=\$clabel" "\$clabel" |
|
229 | 229 | > odd.executable = echo |
|
230 | 230 | > EOF |
|
231 | 231 | #if windows |
|
232 | TODO | |
|
232 | $ hg --debug odd | grep '^running' | |
|
233 | running '"*\\echo.exe" --foo="sp ace" "sp ace" --bar="sp ace" "sp ace"' in * (glob) | |
|
233 | 234 | #else |
|
234 | 235 | $ hg --debug odd | grep '^running' |
|
235 | 236 | running "*/echo --foo='sp ace' 'sp ace' --bar='sp ace' 'sp ace'" in * (glob) |
|
236 | 237 | #endif |
|
237 | 238 | |
|
238 | 239 | Empty argument must be quoted |
|
239 | 240 | |
|
240 | 241 | $ cat <<EOF >> $HGRCPATH |
|
241 | 242 | > [extdiff] |
|
242 | 243 | > kdiff3 = echo |
|
243 | 244 | > [merge-tools] |
|
244 | 245 | > kdiff3.diffargs=--L1 \$plabel1 --L2 \$clabel \$parent \$child |
|
245 | 246 | > EOF |
|
246 | 247 | #if windows |
|
247 | 248 | $ hg --debug kdiff3 -r0 | grep '^running' |
|
248 | 249 | running 'echo --L1 "@0" --L2 "" a.8a5febb7f867 a' in * (glob) |
|
249 | 250 | #else |
|
250 | 251 | $ hg --debug kdiff3 -r0 | grep '^running' |
|
251 | 252 | running "echo --L1 '@0' --L2 '' a.8a5febb7f867 a" in * (glob) |
|
252 | 253 | #endif |
|
253 | 254 | |
|
254 | 255 | #if execbit |
|
255 | 256 | |
|
256 | 257 | Test extdiff of multiple files in tmp dir: |
|
257 | 258 | |
|
258 | 259 | $ hg update -C 0 > /dev/null |
|
259 | 260 | $ echo changed > a |
|
260 | 261 | $ echo changed > b |
|
261 | 262 | $ chmod +x b |
|
262 | 263 | |
|
263 | 264 | Diff in working directory, before: |
|
264 | 265 | |
|
265 | 266 | $ hg diff --git |
|
266 | 267 | diff --git a/a b/a |
|
267 | 268 | --- a/a |
|
268 | 269 | +++ b/a |
|
269 | 270 | @@ -1,1 +1,1 @@ |
|
270 | 271 | -a |
|
271 | 272 | +changed |
|
272 | 273 | diff --git a/b b/b |
|
273 | 274 | old mode 100644 |
|
274 | 275 | new mode 100755 |
|
275 | 276 | --- a/b |
|
276 | 277 | +++ b/b |
|
277 | 278 | @@ -1,1 +1,1 @@ |
|
278 | 279 | -b |
|
279 | 280 | +changed |
|
280 | 281 | |
|
281 | 282 | |
|
282 | 283 | Edit with extdiff -p: |
|
283 | 284 | |
|
284 | 285 | Prepare custom diff/edit tool: |
|
285 | 286 | |
|
286 | 287 | $ cat > 'diff tool.py' << EOT |
|
287 | 288 | > #!/usr/bin/env python |
|
288 | 289 | > import time |
|
289 | 290 | > time.sleep(1) # avoid unchanged-timestamp problems |
|
290 | 291 | > file('a/a', 'ab').write('edited\n') |
|
291 | 292 | > file('a/b', 'ab').write('edited\n') |
|
292 | 293 | > EOT |
|
293 | 294 | |
|
294 | 295 | $ chmod +x 'diff tool.py' |
|
295 | 296 | |
|
296 | 297 | will change to /tmp/extdiff.TMP and populate directories a.TMP and a |
|
297 | 298 | and start tool |
|
298 | 299 | |
|
299 | 300 | $ hg extdiff -p "`pwd`/diff tool.py" |
|
300 | 301 | [1] |
|
301 | 302 | |
|
302 | 303 | Diff in working directory, after: |
|
303 | 304 | |
|
304 | 305 | $ hg diff --git |
|
305 | 306 | diff --git a/a b/a |
|
306 | 307 | --- a/a |
|
307 | 308 | +++ b/a |
|
308 | 309 | @@ -1,1 +1,2 @@ |
|
309 | 310 | -a |
|
310 | 311 | +changed |
|
311 | 312 | +edited |
|
312 | 313 | diff --git a/b b/b |
|
313 | 314 | old mode 100644 |
|
314 | 315 | new mode 100755 |
|
315 | 316 | --- a/b |
|
316 | 317 | +++ b/b |
|
317 | 318 | @@ -1,1 +1,2 @@ |
|
318 | 319 | -b |
|
319 | 320 | +changed |
|
320 | 321 | +edited |
|
321 | 322 | |
|
322 | 323 | Test extdiff with --option: |
|
323 | 324 | |
|
324 | 325 | $ hg extdiff -p echo -o this -c 1 |
|
325 | 326 | this */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob) |
|
326 | 327 | [1] |
|
327 | 328 | |
|
328 | 329 | $ hg falabala -o this -c 1 |
|
329 | 330 | diffing this */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob) |
|
330 | 331 | [1] |
|
331 | 332 | |
|
332 | 333 | Test extdiff's handling of options with spaces in them: |
|
333 | 334 | |
|
334 | 335 | $ hg edspace -c 1 |
|
335 | 336 | name <user@example.com> */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob) |
|
336 | 337 | [1] |
|
337 | 338 | |
|
338 | 339 | $ hg extdiff -p echo -o "name <user@example.com>" -c 1 |
|
339 | 340 | name <user@example.com> */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob) |
|
340 | 341 | [1] |
|
341 | 342 | |
|
342 | 343 | Test with revsets: |
|
343 | 344 | |
|
344 | 345 | $ hg extdif -p echo -c "rev(1)" |
|
345 | 346 | */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob) |
|
346 | 347 | [1] |
|
347 | 348 | |
|
348 | 349 | $ hg extdif -p echo -r "0::1" |
|
349 | 350 | */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob) |
|
350 | 351 | [1] |
|
351 | 352 | |
|
352 | 353 | Fallback to merge-tools.tool.executable|regkey |
|
353 | 354 | $ mkdir dir |
|
354 | 355 | $ cat > 'dir/tool.sh' << EOF |
|
355 | 356 | > #!/bin/sh |
|
356 | 357 | > echo "** custom diff **" |
|
357 | 358 | > EOF |
|
358 | 359 | $ chmod +x dir/tool.sh |
|
359 | 360 | $ tool=`pwd`/dir/tool.sh |
|
360 | 361 | $ hg --debug tl --config extdiff.tl= --config merge-tools.tl.executable=$tool |
|
361 | 362 | making snapshot of 2 files from rev * (glob) |
|
362 | 363 | a |
|
363 | 364 | b |
|
364 | 365 | making snapshot of 2 files from working directory |
|
365 | 366 | a |
|
366 | 367 | b |
|
367 | 368 | running '$TESTTMP/a/dir/tool.sh a.* a' in */extdiff.* (glob) |
|
368 | 369 | ** custom diff ** |
|
369 | 370 | cleaning up temp directory |
|
370 | 371 | [1] |
|
371 | 372 | |
|
372 | 373 | $ cd .. |
|
373 | 374 | |
|
374 | 375 | #endif |
|
375 | 376 | |
|
376 | 377 | #if symlink |
|
377 | 378 | |
|
378 | 379 | Test symlinks handling (issue1909) |
|
379 | 380 | |
|
380 | 381 | $ hg init testsymlinks |
|
381 | 382 | $ cd testsymlinks |
|
382 | 383 | $ echo a > a |
|
383 | 384 | $ hg ci -Am adda |
|
384 | 385 | adding a |
|
385 | 386 | $ echo a >> a |
|
386 | 387 | $ ln -s missing linka |
|
387 | 388 | $ hg add linka |
|
388 | 389 | $ hg falabala -r 0 --traceback |
|
389 | 390 | diffing testsymlinks.07f494440405 testsymlinks |
|
390 | 391 | [1] |
|
391 | 392 | $ cd .. |
|
392 | 393 | |
|
393 | 394 | #endif |
|
394 | 395 | |
|
395 | 396 | Test handling of non-ASCII paths in generated docstrings (issue5301) |
|
396 | 397 | |
|
397 | 398 | >>> open("u", "w").write("\xa5\xa5") |
|
398 | 399 | $ U=`cat u` |
|
399 | 400 | |
|
400 | 401 | $ HGPLAIN=1 hg --config hgext.extdiff= --config extdiff.cmd.td=hi help -k xyzzy |
|
401 | 402 | abort: no matches |
|
402 | 403 | (try 'hg help' for a list of topics) |
|
403 | 404 | [255] |
|
404 | 405 | |
|
405 | 406 | $ HGPLAIN=1 hg --config hgext.extdiff= --config extdiff.cmd.td=hi help td > /dev/null |
|
406 | 407 | |
|
407 | 408 | $ LC_MESSAGES=ja_JP.UTF-8 hg --config hgext.extdiff= --config extdiff.cmd.td=$U help -k xyzzy |
|
408 | 409 | abort: no matches |
|
409 | 410 | (try 'hg help' for a list of topics) |
|
410 | 411 | [255] |
|
411 | 412 | |
|
412 | 413 | $ LC_MESSAGES=ja_JP.UTF-8 hg --config hgext.extdiff= --config extdiff.cmd.td=$U help td \ |
|
413 | 414 | > | grep "^ '" |
|
414 | 415 | '\xa5\xa5' |
General Comments 0
You need to be logged in to leave comments.
Login now