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