##// END OF EJS Templates
test: make test-extdiff resilient to /usr/bin/echo...
Pierre-Yves David -
r23974:e484546a stable
parent child Browse files
Show More
@@ -1,324 +1,324 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 "*/bin/echo --foo='sp ace' 'sp ace' --bar='sp ace' 'sp ace'" in * (glob)
183 #endif
183 #endif
184
184
185 #if execbit
185 #if execbit
186
186
187 Test extdiff of multiple files in tmp dir:
187 Test extdiff of multiple files in tmp dir:
188
188
189 $ hg update -C 0 > /dev/null
189 $ hg update -C 0 > /dev/null
190 $ echo changed > a
190 $ echo changed > a
191 $ echo changed > b
191 $ echo changed > b
192 $ chmod +x b
192 $ chmod +x b
193
193
194 Diff in working directory, before:
194 Diff in working directory, before:
195
195
196 $ hg diff --git
196 $ hg diff --git
197 diff --git a/a b/a
197 diff --git a/a b/a
198 --- a/a
198 --- a/a
199 +++ b/a
199 +++ b/a
200 @@ -1,1 +1,1 @@
200 @@ -1,1 +1,1 @@
201 -a
201 -a
202 +changed
202 +changed
203 diff --git a/b b/b
203 diff --git a/b b/b
204 old mode 100644
204 old mode 100644
205 new mode 100755
205 new mode 100755
206 --- a/b
206 --- a/b
207 +++ b/b
207 +++ b/b
208 @@ -1,1 +1,1 @@
208 @@ -1,1 +1,1 @@
209 -b
209 -b
210 +changed
210 +changed
211
211
212
212
213 Edit with extdiff -p:
213 Edit with extdiff -p:
214
214
215 Prepare custom diff/edit tool:
215 Prepare custom diff/edit tool:
216
216
217 $ cat > 'diff tool.py' << EOT
217 $ cat > 'diff tool.py' << EOT
218 > #!/usr/bin/env python
218 > #!/usr/bin/env python
219 > import time
219 > import time
220 > time.sleep(1) # avoid unchanged-timestamp problems
220 > time.sleep(1) # avoid unchanged-timestamp problems
221 > file('a/a', 'ab').write('edited\n')
221 > file('a/a', 'ab').write('edited\n')
222 > file('a/b', 'ab').write('edited\n')
222 > file('a/b', 'ab').write('edited\n')
223 > EOT
223 > EOT
224
224
225 $ chmod +x 'diff tool.py'
225 $ chmod +x 'diff tool.py'
226
226
227 will change to /tmp/extdiff.TMP and populate directories a.TMP and a
227 will change to /tmp/extdiff.TMP and populate directories a.TMP and a
228 and start tool
228 and start tool
229
229
230 $ hg extdiff -p "`pwd`/diff tool.py"
230 $ hg extdiff -p "`pwd`/diff tool.py"
231 [1]
231 [1]
232
232
233 Diff in working directory, after:
233 Diff in working directory, after:
234
234
235 $ hg diff --git
235 $ hg diff --git
236 diff --git a/a b/a
236 diff --git a/a b/a
237 --- a/a
237 --- a/a
238 +++ b/a
238 +++ b/a
239 @@ -1,1 +1,2 @@
239 @@ -1,1 +1,2 @@
240 -a
240 -a
241 +changed
241 +changed
242 +edited
242 +edited
243 diff --git a/b b/b
243 diff --git a/b b/b
244 old mode 100644
244 old mode 100644
245 new mode 100755
245 new mode 100755
246 --- a/b
246 --- a/b
247 +++ b/b
247 +++ b/b
248 @@ -1,1 +1,2 @@
248 @@ -1,1 +1,2 @@
249 -b
249 -b
250 +changed
250 +changed
251 +edited
251 +edited
252
252
253 Test extdiff with --option:
253 Test extdiff with --option:
254
254
255 $ hg extdiff -p echo -o this -c 1
255 $ hg extdiff -p echo -o this -c 1
256 this */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
256 this */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
257 [1]
257 [1]
258
258
259 $ hg falabala -o this -c 1
259 $ hg falabala -o this -c 1
260 diffing this */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
260 diffing this */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
261 [1]
261 [1]
262
262
263 Test extdiff's handling of options with spaces in them:
263 Test extdiff's handling of options with spaces in them:
264
264
265 $ hg edspace -c 1
265 $ hg edspace -c 1
266 name <user@example.com> */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
266 name <user@example.com> */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
267 [1]
267 [1]
268
268
269 $ hg extdiff -p echo -o "name <user@example.com>" -c 1
269 $ hg extdiff -p echo -o "name <user@example.com>" -c 1
270 name <user@example.com> */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
270 name <user@example.com> */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
271 [1]
271 [1]
272
272
273 Test with revsets:
273 Test with revsets:
274
274
275 $ hg extdif -p echo -c "rev(1)"
275 $ hg extdif -p echo -c "rev(1)"
276 */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
276 */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
277 [1]
277 [1]
278
278
279 $ hg extdif -p echo -r "0::1"
279 $ hg extdif -p echo -r "0::1"
280 */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
280 */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
281 [1]
281 [1]
282
282
283 Fallback to merge-tools.tool.executable|regkey
283 Fallback to merge-tools.tool.executable|regkey
284 $ mkdir dir
284 $ mkdir dir
285 $ cat > 'dir/tool.sh' << EOF
285 $ cat > 'dir/tool.sh' << EOF
286 > #!/bin/sh
286 > #!/bin/sh
287 > echo "** custom diff **"
287 > echo "** custom diff **"
288 > EOF
288 > EOF
289 $ chmod +x dir/tool.sh
289 $ chmod +x dir/tool.sh
290 $ tool=`pwd`/dir/tool.sh
290 $ tool=`pwd`/dir/tool.sh
291 $ hg --debug tl --config extdiff.tl= --config merge-tools.tl.executable=$tool
291 $ hg --debug tl --config extdiff.tl= --config merge-tools.tl.executable=$tool
292 making snapshot of 2 files from rev * (glob)
292 making snapshot of 2 files from rev * (glob)
293 a
293 a
294 b
294 b
295 making snapshot of 2 files from working directory
295 making snapshot of 2 files from working directory
296 a
296 a
297 b
297 b
298 running '$TESTTMP/a/dir/tool.sh a.* a' in */extdiff.* (glob)
298 running '$TESTTMP/a/dir/tool.sh a.* a' in */extdiff.* (glob)
299 ** custom diff **
299 ** custom diff **
300 cleaning up temp directory
300 cleaning up temp directory
301 [1]
301 [1]
302
302
303 $ cd ..
303 $ cd ..
304
304
305 #endif
305 #endif
306
306
307 #if symlink
307 #if symlink
308
308
309 Test symlinks handling (issue1909)
309 Test symlinks handling (issue1909)
310
310
311 $ hg init testsymlinks
311 $ hg init testsymlinks
312 $ cd testsymlinks
312 $ cd testsymlinks
313 $ echo a > a
313 $ echo a > a
314 $ hg ci -Am adda
314 $ hg ci -Am adda
315 adding a
315 adding a
316 $ echo a >> a
316 $ echo a >> a
317 $ ln -s missing linka
317 $ ln -s missing linka
318 $ hg add linka
318 $ hg add linka
319 $ hg falabala -r 0 --traceback
319 $ hg falabala -r 0 --traceback
320 diffing testsymlinks.07f494440405 testsymlinks
320 diffing testsymlinks.07f494440405 testsymlinks
321 [1]
321 [1]
322 $ cd ..
322 $ cd ..
323
323
324 #endif
324 #endif
General Comments 0
You need to be logged in to leave comments. Login now