##// END OF EJS Templates
test-merge-tools: Don't use tac...
Mads Kiilerich -
r7769:8c06d4bf default
parent child Browse files
Show More
@@ -1,150 +1,150
1 1 #!/bin/sh
2 2
3 3 # test merge-tools configuration - mostly exercising filemerge.py
4 4
5 5 unset HGMERGE # make sure HGMERGE doesn't interfere with the test
6 6
7 7 hg init
8 8
9 9 echo "# revision 0"
10 10 echo "revision 0" > f
11 11 echo "space" >> f
12 12 hg commit -Am "revision 0" -d "1000000 0"
13 13
14 14 echo "# revision 1"
15 15 echo "revision 1" > f
16 16 echo "space" >> f
17 17 hg commit -Am "revision 1" -d "1000000 0"
18 18
19 19 hg update 0 > /dev/null
20 20 echo "# revision 2"
21 21 echo "revision 2" > f
22 22 echo "space" >> f
23 23 hg commit -Am "revision 2" -d "1000000 0"
24 24
25 25 hg update 0 > /dev/null
26 26 echo "# revision 3 - simple to merge"
27 27 echo "revision 3" >> f
28 28 hg commit -Am "revision 3" -d "1000000 0"
29 29
30 30
31 31 echo "[merge-tools]" > .hg/hgrc
32 32 echo
33 33
34 34 beforemerge() {
35 35 cat .hg/hgrc
36 36 echo "# hg update -C 1"
37 37 hg update -C 1 > /dev/null
38 38 }
39 39
40 40 aftermerge() {
41 41 echo "# cat f"
42 42 cat f
43 43 echo "# hg stat"
44 44 hg stat
45 45 rm -f f.orig
46 46 echo
47 47 }
48 48
49 49 domerge() {
50 50 beforemerge
51 51 echo "# hg merge $*"
52 52 hg merge $*
53 53 aftermerge
54 54 }
55 55
56 56 echo
57 57 echo Tool selection
58 58 echo
59 59
60 60 echo "# default is internal merge:"
61 61 domerge -r 2
62 62
63 63 echo "# simplest hgrc using false for merge:"
64 64 echo "false.whatever=" >> .hg/hgrc
65 65 domerge -r 2
66 66
67 67 echo "# true with higher .priority gets precedence:"
68 68 echo "true.priority=1" >> .hg/hgrc
69 69 domerge -r 2
70 70
71 71 echo "# unless lowered on command line:"
72 72 domerge -r 2 --config merge-tools.true.priority=-7
73 73
74 74 echo "# or false set higher on command line:"
75 75 domerge -r 2 --config merge-tools.false.priority=117
76 76
77 77 echo "# or true.executable not found in PATH:"
78 78 domerge -r 2 --config merge-tools.true.executable=nonexistingmergetool
79 79
80 80 echo "# or true.executable with bogus path:"
81 81 domerge -r 2 --config merge-tools.true.executable=/bin/nonexistingmergetool
82 82
83 83 echo "# but true.executable set to cat found in PATH works:"
84 84 echo "true.executable=cat" >> .hg/hgrc
85 85 domerge -r 2
86 86
87 87 echo "# and true.executable set to cat with path works:"
88 88 domerge -r 2 --config merge-tools.true.executable=/bin/cat
89 89
90 90
91 91 echo
92 92 echo Tool selection and merge-patterns
93 93 echo
94 94
95 echo "# merge-patterns specifies new tool tac:"
96 domerge -r 2 --config merge-patterns.f=tac
95 echo "# merge-patterns specifies new tool false:"
96 domerge -r 2 --config merge-patterns.f=false
97 97
98 98 echo "# merge-patterns specifies executable not found in PATH and gets warning:"
99 99 domerge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistingmergetool
100 100
101 101 echo "# merge-patterns specifies executable with bogus path and gets warning:"
102 102 domerge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/bin/nonexistingmergetool
103 103
104 104
105 105 echo
106 106 echo Premerge
107 107 echo
108 108
109 109 echo "# Default is silent simplemerge:"
110 110 domerge -r 3
111 111
112 112 echo "# .premerge=True is same:"
113 113 domerge -r 3 --config merge-tools.true.premerge=True
114 114
115 115 echo "# .premerge=False executes merge-tool:"
116 116 domerge -r 3 --config merge-tools.true.premerge=False
117 117
118 118
119 119 echo
120 120 echo Tool execution
121 121 echo
122 122
123 123 echo '# set tools.args explicit to include $base $local $other $output:' # default '$local $base $other'
124 124 beforemerge
125 125 hg merge -r 2 --config merge-tools.true.executable=head --config merge-tools.true.args='$base $local $other $output' \
126 126 | sed 's,==> .* <==,==> ... <==,g'
127 127 aftermerge
128 128
129 129 echo '# Merge with "echo mergeresult > $local":'
130 130 beforemerge
131 131 hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $local'
132 132 aftermerge
133 133
134 134 echo '# - and $local is the file f:'
135 135 beforemerge
136 136 hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > f'
137 137 aftermerge
138 138
139 139 echo '# Merge with "echo mergeresult > $output" - the variable is a bit magic:'
140 140 beforemerge
141 141 hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $output'
142 142 aftermerge
143 143
144 144
145 145 echo
146 146 echo Merge post-processing
147 147 echo
148 148
149 149 echo "# cat is a bad merge-tool and doesn't change:"
150 150 domerge -r 2 --config merge-tools.true.checkchanged=1
@@ -1,399 +1,395
1 1 # revision 0
2 2 adding f
3 3 # revision 1
4 4 # revision 2
5 5 created new head
6 6 # revision 3 - simple to merge
7 7 created new head
8 8
9 9
10 10 Tool selection
11 11
12 12 # default is internal merge:
13 13 [merge-tools]
14 14 # hg update -C 1
15 15 # hg merge -r 2
16 16 merging f
17 17 warning: conflicts during merge.
18 18 merging f failed!
19 19 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
20 20 use 'hg resolve' to retry unresolved file merges
21 21 # cat f
22 22 <<<<<<< local
23 23 revision 1
24 24 =======
25 25 revision 2
26 26 >>>>>>> other
27 27 space
28 28 # hg stat
29 29 M f
30 30 ? f.orig
31 31
32 32 # simplest hgrc using false for merge:
33 33 [merge-tools]
34 34 false.whatever=
35 35 # hg update -C 1
36 36 # hg merge -r 2
37 37 merging f
38 38 merging f failed!
39 39 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
40 40 use 'hg resolve' to retry unresolved file merges
41 41 # cat f
42 42 revision 1
43 43 space
44 44 # hg stat
45 45 M f
46 46 ? f.orig
47 47
48 48 # true with higher .priority gets precedence:
49 49 [merge-tools]
50 50 false.whatever=
51 51 true.priority=1
52 52 # hg update -C 1
53 53 # hg merge -r 2
54 54 merging f
55 55 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
56 56 (branch merge, don't forget to commit)
57 57 # cat f
58 58 revision 1
59 59 space
60 60 # hg stat
61 61 M f
62 62
63 63 # unless lowered on command line:
64 64 [merge-tools]
65 65 false.whatever=
66 66 true.priority=1
67 67 # hg update -C 1
68 68 # hg merge -r 2 --config merge-tools.true.priority=-7
69 69 merging f
70 70 merging f failed!
71 71 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
72 72 use 'hg resolve' to retry unresolved file merges
73 73 # cat f
74 74 revision 1
75 75 space
76 76 # hg stat
77 77 M f
78 78 ? f.orig
79 79
80 80 # or false set higher on command line:
81 81 [merge-tools]
82 82 false.whatever=
83 83 true.priority=1
84 84 # hg update -C 1
85 85 # hg merge -r 2 --config merge-tools.false.priority=117
86 86 merging f
87 87 merging f failed!
88 88 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
89 89 use 'hg resolve' to retry unresolved file merges
90 90 # cat f
91 91 revision 1
92 92 space
93 93 # hg stat
94 94 M f
95 95 ? f.orig
96 96
97 97 # or true.executable not found in PATH:
98 98 [merge-tools]
99 99 false.whatever=
100 100 true.priority=1
101 101 # hg update -C 1
102 102 # hg merge -r 2 --config merge-tools.true.executable=nonexistingmergetool
103 103 merging f
104 104 merging f failed!
105 105 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
106 106 use 'hg resolve' to retry unresolved file merges
107 107 # cat f
108 108 revision 1
109 109 space
110 110 # hg stat
111 111 M f
112 112 ? f.orig
113 113
114 114 # or true.executable with bogus path:
115 115 [merge-tools]
116 116 false.whatever=
117 117 true.priority=1
118 118 # hg update -C 1
119 119 # hg merge -r 2 --config merge-tools.true.executable=/bin/nonexistingmergetool
120 120 merging f
121 121 merging f failed!
122 122 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
123 123 use 'hg resolve' to retry unresolved file merges
124 124 # cat f
125 125 revision 1
126 126 space
127 127 # hg stat
128 128 M f
129 129 ? f.orig
130 130
131 131 # but true.executable set to cat found in PATH works:
132 132 [merge-tools]
133 133 false.whatever=
134 134 true.priority=1
135 135 true.executable=cat
136 136 # hg update -C 1
137 137 # hg merge -r 2
138 138 revision 1
139 139 space
140 140 revision 0
141 141 space
142 142 revision 2
143 143 space
144 144 merging f
145 145 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
146 146 (branch merge, don't forget to commit)
147 147 # cat f
148 148 revision 1
149 149 space
150 150 # hg stat
151 151 M f
152 152
153 153 # and true.executable set to cat with path works:
154 154 [merge-tools]
155 155 false.whatever=
156 156 true.priority=1
157 157 true.executable=cat
158 158 # hg update -C 1
159 159 # hg merge -r 2 --config merge-tools.true.executable=/bin/cat
160 160 revision 1
161 161 space
162 162 revision 0
163 163 space
164 164 revision 2
165 165 space
166 166 merging f
167 167 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
168 168 (branch merge, don't forget to commit)
169 169 # cat f
170 170 revision 1
171 171 space
172 172 # hg stat
173 173 M f
174 174
175 175
176 176 Tool selection and merge-patterns
177 177
178 # merge-patterns specifies new tool tac:
178 # merge-patterns specifies new tool false:
179 179 [merge-tools]
180 180 false.whatever=
181 181 true.priority=1
182 182 true.executable=cat
183 183 # hg update -C 1
184 # hg merge -r 2 --config merge-patterns.f=tac
185 space
186 revision 1
187 space
188 revision 0
189 space
190 revision 2
184 # hg merge -r 2 --config merge-patterns.f=false
191 185 merging f
192 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
193 (branch merge, don't forget to commit)
186 merging f failed!
187 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
188 use 'hg resolve' to retry unresolved file merges
194 189 # cat f
195 190 revision 1
196 191 space
197 192 # hg stat
198 193 M f
194 ? f.orig
199 195
200 196 # merge-patterns specifies executable not found in PATH and gets warning:
201 197 [merge-tools]
202 198 false.whatever=
203 199 true.priority=1
204 200 true.executable=cat
205 201 # hg update -C 1
206 202 # hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistingmergetool
207 203 couldn't find merge tool true specified for f
208 204 merging f
209 205 merging f failed!
210 206 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
211 207 use 'hg resolve' to retry unresolved file merges
212 208 # cat f
213 209 revision 1
214 210 space
215 211 # hg stat
216 212 M f
217 213 ? f.orig
218 214
219 215 # merge-patterns specifies executable with bogus path and gets warning:
220 216 [merge-tools]
221 217 false.whatever=
222 218 true.priority=1
223 219 true.executable=cat
224 220 # hg update -C 1
225 221 # hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/bin/nonexistingmergetool
226 222 couldn't find merge tool true specified for f
227 223 merging f
228 224 merging f failed!
229 225 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
230 226 use 'hg resolve' to retry unresolved file merges
231 227 # cat f
232 228 revision 1
233 229 space
234 230 # hg stat
235 231 M f
236 232 ? f.orig
237 233
238 234
239 235 Premerge
240 236
241 237 # Default is silent simplemerge:
242 238 [merge-tools]
243 239 false.whatever=
244 240 true.priority=1
245 241 true.executable=cat
246 242 # hg update -C 1
247 243 # hg merge -r 3
248 244 merging f
249 245 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
250 246 (branch merge, don't forget to commit)
251 247 # cat f
252 248 revision 1
253 249 space
254 250 revision 3
255 251 # hg stat
256 252 M f
257 253
258 254 # .premerge=True is same:
259 255 [merge-tools]
260 256 false.whatever=
261 257 true.priority=1
262 258 true.executable=cat
263 259 # hg update -C 1
264 260 # hg merge -r 3 --config merge-tools.true.premerge=True
265 261 merging f
266 262 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
267 263 (branch merge, don't forget to commit)
268 264 # cat f
269 265 revision 1
270 266 space
271 267 revision 3
272 268 # hg stat
273 269 M f
274 270
275 271 # .premerge=False executes merge-tool:
276 272 [merge-tools]
277 273 false.whatever=
278 274 true.priority=1
279 275 true.executable=cat
280 276 # hg update -C 1
281 277 # hg merge -r 3 --config merge-tools.true.premerge=False
282 278 revision 1
283 279 space
284 280 revision 0
285 281 space
286 282 revision 0
287 283 space
288 284 revision 3
289 285 merging f
290 286 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
291 287 (branch merge, don't forget to commit)
292 288 # cat f
293 289 revision 1
294 290 space
295 291 # hg stat
296 292 M f
297 293
298 294
299 295 Tool execution
300 296
301 297 # set tools.args explicit to include $base $local $other $output:
302 298 [merge-tools]
303 299 false.whatever=
304 300 true.priority=1
305 301 true.executable=cat
306 302 # hg update -C 1
307 303 ==> ... <==
308 304 revision 0
309 305 space
310 306
311 307 ==> ... <==
312 308 revision 1
313 309 space
314 310
315 311 ==> ... <==
316 312 revision 2
317 313 space
318 314
319 315 ==> ... <==
320 316 revision 1
321 317 space
322 318 merging f
323 319 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
324 320 (branch merge, don't forget to commit)
325 321 # cat f
326 322 revision 1
327 323 space
328 324 # hg stat
329 325 M f
330 326
331 327 # Merge with "echo mergeresult > $local":
332 328 [merge-tools]
333 329 false.whatever=
334 330 true.priority=1
335 331 true.executable=cat
336 332 # hg update -C 1
337 333 merging f
338 334 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
339 335 (branch merge, don't forget to commit)
340 336 # cat f
341 337 mergeresult
342 338 # hg stat
343 339 M f
344 340
345 341 # - and $local is the file f:
346 342 [merge-tools]
347 343 false.whatever=
348 344 true.priority=1
349 345 true.executable=cat
350 346 # hg update -C 1
351 347 merging f
352 348 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
353 349 (branch merge, don't forget to commit)
354 350 # cat f
355 351 mergeresult
356 352 # hg stat
357 353 M f
358 354
359 355 # Merge with "echo mergeresult > $output" - the variable is a bit magic:
360 356 [merge-tools]
361 357 false.whatever=
362 358 true.priority=1
363 359 true.executable=cat
364 360 # hg update -C 1
365 361 merging f
366 362 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
367 363 (branch merge, don't forget to commit)
368 364 # cat f
369 365 mergeresult
370 366 # hg stat
371 367 M f
372 368
373 369
374 370 Merge post-processing
375 371
376 372 # cat is a bad merge-tool and doesn't change:
377 373 [merge-tools]
378 374 false.whatever=
379 375 true.priority=1
380 376 true.executable=cat
381 377 # hg update -C 1
382 378 # hg merge -r 2 --config merge-tools.true.checkchanged=1
383 379 revision 1
384 380 space
385 381 revision 0
386 382 space
387 383 revision 2
388 384 space
389 385 merging f
390 386 merging f failed!
391 387 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
392 388 use 'hg resolve' to retry unresolved file merges
393 389 # cat f
394 390 revision 1
395 391 space
396 392 # hg stat
397 393 M f
398 394 ? f.orig
399 395
General Comments 0
You need to be logged in to leave comments. Login now