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