##// END OF EJS Templates
tests: demonstrate that no requested merge tool is ignored if missing...
Martin von Zweigbergk -
r38986:6bfd1054 default
parent child Browse files
Show More
@@ -1,1850 +1,1872 b''
1 1 test merge-tools configuration - mostly exercising filemerge.py
2 2
3 3 $ unset HGMERGE # make sure HGMERGE doesn't interfere with the test
4 4 $ hg init repo
5 5 $ cd repo
6 6
7 7 revision 0
8 8
9 9 $ echo "revision 0" > f
10 10 $ echo "space" >> f
11 11 $ hg commit -Am "revision 0"
12 12 adding f
13 13
14 14 revision 1
15 15
16 16 $ echo "revision 1" > f
17 17 $ echo "space" >> f
18 18 $ hg commit -Am "revision 1"
19 19 $ hg update 0 > /dev/null
20 20
21 21 revision 2
22 22
23 23 $ echo "revision 2" > f
24 24 $ echo "space" >> f
25 25 $ hg commit -Am "revision 2"
26 26 created new head
27 27 $ hg update 0 > /dev/null
28 28
29 29 revision 3 - simple to merge
30 30
31 31 $ echo "revision 3" >> f
32 32 $ hg commit -Am "revision 3"
33 33 created new head
34 34
35 35 revision 4 - hard to merge
36 36
37 37 $ hg update 0 > /dev/null
38 38 $ echo "revision 4" > f
39 39 $ hg commit -Am "revision 4"
40 40 created new head
41 41
42 42 $ echo "[merge-tools]" > .hg/hgrc
43 43
44 44 $ beforemerge() {
45 45 > cat .hg/hgrc
46 46 > echo "# hg update -C 1"
47 47 > hg update -C 1 > /dev/null
48 48 > }
49 49 $ aftermerge() {
50 50 > echo "# cat f"
51 51 > cat f
52 52 > echo "# hg stat"
53 53 > hg stat
54 54 > echo "# hg resolve --list"
55 55 > hg resolve --list
56 56 > rm -f f.orig
57 57 > }
58 58
59 59 Tool selection
60 60
61 61 default is internal merge:
62 62
63 63 $ beforemerge
64 64 [merge-tools]
65 65 # hg update -C 1
66 66
67 67 hg merge -r 2
68 68 override $PATH to ensure hgmerge not visible; use $PYTHON in case we're
69 69 running from a devel copy, not a temp installation
70 70
71 71 $ PATH="$BINDIR:/usr/sbin" $PYTHON "$BINDIR"/hg merge -r 2
72 72 merging f
73 73 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
74 74 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
75 75 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
76 76 [1]
77 77 $ aftermerge
78 78 # cat f
79 79 <<<<<<< working copy: ef83787e2614 - test: revision 1
80 80 revision 1
81 81 =======
82 82 revision 2
83 83 >>>>>>> merge rev: 0185f4e0cf02 - test: revision 2
84 84 space
85 85 # hg stat
86 86 M f
87 87 ? f.orig
88 88 # hg resolve --list
89 89 U f
90 90
91 91 simplest hgrc using false for merge:
92 92
93 93 $ echo "false.whatever=" >> .hg/hgrc
94 94 $ beforemerge
95 95 [merge-tools]
96 96 false.whatever=
97 97 # hg update -C 1
98 98 $ hg merge -r 2
99 99 merging f
100 100 merging f failed!
101 101 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
102 102 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
103 103 [1]
104 104 $ aftermerge
105 105 # cat f
106 106 revision 1
107 107 space
108 108 # hg stat
109 109 M f
110 110 ? f.orig
111 111 # hg resolve --list
112 112 U f
113 113
114 114 #if unix-permissions
115 115
116 116 unexecutable file in $PATH shouldn't be found:
117 117
118 118 $ echo "echo fail" > false
119 119 $ hg up -qC 1
120 120 $ PATH="`pwd`:$BINDIR:/usr/sbin" $PYTHON "$BINDIR"/hg merge -r 2
121 121 merging f
122 122 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
123 123 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
124 124 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
125 125 [1]
126 126 $ rm false
127 127
128 128 #endif
129 129
130 130 executable directory in $PATH shouldn't be found:
131 131
132 132 $ mkdir false
133 133 $ hg up -qC 1
134 134 $ PATH="`pwd`:$BINDIR:/usr/sbin" $PYTHON "$BINDIR"/hg merge -r 2
135 135 merging f
136 136 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
137 137 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
138 138 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
139 139 [1]
140 140 $ rmdir false
141 141
142 142 true with higher .priority gets precedence:
143 143
144 144 $ echo "true.priority=1" >> .hg/hgrc
145 145 $ beforemerge
146 146 [merge-tools]
147 147 false.whatever=
148 148 true.priority=1
149 149 # hg update -C 1
150 150 $ hg merge -r 2
151 151 merging f
152 152 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
153 153 (branch merge, don't forget to commit)
154 154 $ aftermerge
155 155 # cat f
156 156 revision 1
157 157 space
158 158 # hg stat
159 159 M f
160 160 # hg resolve --list
161 161 R f
162 162
163 163 unless lowered on command line:
164 164
165 165 $ beforemerge
166 166 [merge-tools]
167 167 false.whatever=
168 168 true.priority=1
169 169 # hg update -C 1
170 170 $ hg merge -r 2 --config merge-tools.true.priority=-7
171 171 merging f
172 172 merging f failed!
173 173 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
174 174 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
175 175 [1]
176 176 $ aftermerge
177 177 # cat f
178 178 revision 1
179 179 space
180 180 # hg stat
181 181 M f
182 182 ? f.orig
183 183 # hg resolve --list
184 184 U f
185 185
186 186 or false set higher on command line:
187 187
188 188 $ beforemerge
189 189 [merge-tools]
190 190 false.whatever=
191 191 true.priority=1
192 192 # hg update -C 1
193 193 $ hg merge -r 2 --config merge-tools.false.priority=117
194 194 merging f
195 195 merging f failed!
196 196 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
197 197 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
198 198 [1]
199 199 $ aftermerge
200 200 # cat f
201 201 revision 1
202 202 space
203 203 # hg stat
204 204 M f
205 205 ? f.orig
206 206 # hg resolve --list
207 207 U f
208 208
209 209 or true set to disabled:
210 210 $ beforemerge
211 211 [merge-tools]
212 212 false.whatever=
213 213 true.priority=1
214 214 # hg update -C 1
215 215 $ hg merge -r 2 --config merge-tools.true.disabled=yes
216 216 merging f
217 217 merging f failed!
218 218 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
219 219 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
220 220 [1]
221 221 $ aftermerge
222 222 # cat f
223 223 revision 1
224 224 space
225 225 # hg stat
226 226 M f
227 227 ? f.orig
228 228 # hg resolve --list
229 229 U f
230 230
231 231 or true.executable not found in PATH:
232 232
233 233 $ beforemerge
234 234 [merge-tools]
235 235 false.whatever=
236 236 true.priority=1
237 237 # hg update -C 1
238 238 $ hg merge -r 2 --config merge-tools.true.executable=nonexistentmergetool
239 239 merging f
240 240 merging f failed!
241 241 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
242 242 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
243 243 [1]
244 244 $ aftermerge
245 245 # cat f
246 246 revision 1
247 247 space
248 248 # hg stat
249 249 M f
250 250 ? f.orig
251 251 # hg resolve --list
252 252 U f
253 253
254 254 or true.executable with bogus path:
255 255
256 256 $ beforemerge
257 257 [merge-tools]
258 258 false.whatever=
259 259 true.priority=1
260 260 # hg update -C 1
261 261 $ hg merge -r 2 --config merge-tools.true.executable=/nonexistent/mergetool
262 262 merging f
263 263 merging f failed!
264 264 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
265 265 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
266 266 [1]
267 267 $ aftermerge
268 268 # cat f
269 269 revision 1
270 270 space
271 271 # hg stat
272 272 M f
273 273 ? f.orig
274 274 # hg resolve --list
275 275 U f
276 276
277 277 but true.executable set to cat found in PATH works:
278 278
279 279 $ echo "true.executable=cat" >> .hg/hgrc
280 280 $ beforemerge
281 281 [merge-tools]
282 282 false.whatever=
283 283 true.priority=1
284 284 true.executable=cat
285 285 # hg update -C 1
286 286 $ hg merge -r 2
287 287 merging f
288 288 revision 1
289 289 space
290 290 revision 0
291 291 space
292 292 revision 2
293 293 space
294 294 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
295 295 (branch merge, don't forget to commit)
296 296 $ aftermerge
297 297 # cat f
298 298 revision 1
299 299 space
300 300 # hg stat
301 301 M f
302 302 # hg resolve --list
303 303 R f
304 304
305 305 and true.executable set to cat with path works:
306 306
307 307 $ beforemerge
308 308 [merge-tools]
309 309 false.whatever=
310 310 true.priority=1
311 311 true.executable=cat
312 312 # hg update -C 1
313 313 $ hg merge -r 2 --config merge-tools.true.executable=cat
314 314 merging f
315 315 revision 1
316 316 space
317 317 revision 0
318 318 space
319 319 revision 2
320 320 space
321 321 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
322 322 (branch merge, don't forget to commit)
323 323 $ aftermerge
324 324 # cat f
325 325 revision 1
326 326 space
327 327 # hg stat
328 328 M f
329 329 # hg resolve --list
330 330 R f
331 331
332 332 executable set to python script that succeeds:
333 333
334 334 $ cat > "$TESTTMP/myworkingmerge.py" <<EOF
335 335 > def myworkingmergefn(ui, repo, args, **kwargs):
336 336 > return False
337 337 > EOF
338 338 $ beforemerge
339 339 [merge-tools]
340 340 false.whatever=
341 341 true.priority=1
342 342 true.executable=cat
343 343 # hg update -C 1
344 344 $ hg merge -r 2 --config merge-tools.true.executable="python:$TESTTMP/myworkingmerge.py:myworkingmergefn"
345 345 merging f
346 346 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
347 347 (branch merge, don't forget to commit)
348 348 $ aftermerge
349 349 # cat f
350 350 revision 1
351 351 space
352 352 # hg stat
353 353 M f
354 354 # hg resolve --list
355 355 R f
356 356
357 357 executable set to python script that fails:
358 358
359 359 $ cat > "$TESTTMP/mybrokenmerge.py" <<EOF
360 360 > def mybrokenmergefn(ui, repo, args, **kwargs):
361 361 > ui.write(b"some fail message\n")
362 362 > return True
363 363 > EOF
364 364 $ beforemerge
365 365 [merge-tools]
366 366 false.whatever=
367 367 true.priority=1
368 368 true.executable=cat
369 369 # hg update -C 1
370 370 $ hg merge -r 2 --config merge-tools.true.executable="python:$TESTTMP/mybrokenmerge.py:mybrokenmergefn"
371 371 merging f
372 372 some fail message
373 373 abort: $TESTTMP/mybrokenmerge.py hook failed
374 374 [255]
375 375 $ aftermerge
376 376 # cat f
377 377 revision 1
378 378 space
379 379 # hg stat
380 380 ? f.orig
381 381 # hg resolve --list
382 382 U f
383 383
384 384 executable set to python script that is missing function:
385 385
386 386 $ beforemerge
387 387 [merge-tools]
388 388 false.whatever=
389 389 true.priority=1
390 390 true.executable=cat
391 391 # hg update -C 1
392 392 $ hg merge -r 2 --config merge-tools.true.executable="python:$TESTTMP/myworkingmerge.py:missingFunction"
393 393 merging f
394 394 abort: $TESTTMP/myworkingmerge.py does not have function: missingFunction
395 395 [255]
396 396 $ aftermerge
397 397 # cat f
398 398 revision 1
399 399 space
400 400 # hg stat
401 401 ? f.orig
402 402 # hg resolve --list
403 403 U f
404 404
405 405 executable set to missing python script:
406 406
407 407 $ beforemerge
408 408 [merge-tools]
409 409 false.whatever=
410 410 true.priority=1
411 411 true.executable=cat
412 412 # hg update -C 1
413 413 $ hg merge -r 2 --config merge-tools.true.executable="python:$TESTTMP/missingpythonscript.py:mergefn"
414 414 merging f
415 415 abort: loading python merge script failed: $TESTTMP/missingpythonscript.py
416 416 [255]
417 417 $ aftermerge
418 418 # cat f
419 419 revision 1
420 420 space
421 421 # hg stat
422 422 ? f.orig
423 423 # hg resolve --list
424 424 U f
425 425
426 426 executable set to python script but callable function is missing:
427 427
428 428 $ beforemerge
429 429 [merge-tools]
430 430 false.whatever=
431 431 true.priority=1
432 432 true.executable=cat
433 433 # hg update -C 1
434 434 $ hg merge -r 2 --config merge-tools.true.executable="python:$TESTTMP/myworkingmerge.py"
435 435 abort: invalid 'python:' syntax: python:$TESTTMP/myworkingmerge.py
436 436 [255]
437 437 $ aftermerge
438 438 # cat f
439 439 revision 1
440 440 space
441 441 # hg stat
442 442 # hg resolve --list
443 443 U f
444 444
445 445 executable set to python script but callable function is empty string:
446 446
447 447 $ beforemerge
448 448 [merge-tools]
449 449 false.whatever=
450 450 true.priority=1
451 451 true.executable=cat
452 452 # hg update -C 1
453 453 $ hg merge -r 2 --config merge-tools.true.executable="python:$TESTTMP/myworkingmerge.py:"
454 454 abort: invalid 'python:' syntax: python:$TESTTMP/myworkingmerge.py:
455 455 [255]
456 456 $ aftermerge
457 457 # cat f
458 458 revision 1
459 459 space
460 460 # hg stat
461 461 # hg resolve --list
462 462 U f
463 463
464 464 executable set to python script but callable function is missing and path contains colon:
465 465
466 466 $ beforemerge
467 467 [merge-tools]
468 468 false.whatever=
469 469 true.priority=1
470 470 true.executable=cat
471 471 # hg update -C 1
472 472 $ hg merge -r 2 --config merge-tools.true.executable="python:$TESTTMP/some:dir/myworkingmerge.py"
473 473 abort: invalid 'python:' syntax: python:$TESTTMP/some:dir/myworkingmerge.py
474 474 [255]
475 475 $ aftermerge
476 476 # cat f
477 477 revision 1
478 478 space
479 479 # hg stat
480 480 # hg resolve --list
481 481 U f
482 482
483 483 executable set to python script filename that contains spaces:
484 484
485 485 $ mkdir -p "$TESTTMP/my path"
486 486 $ cat > "$TESTTMP/my path/my working merge with spaces in filename.py" <<EOF
487 487 > def myworkingmergefn(ui, repo, args, **kwargs):
488 488 > return False
489 489 > EOF
490 490 $ beforemerge
491 491 [merge-tools]
492 492 false.whatever=
493 493 true.priority=1
494 494 true.executable=cat
495 495 # hg update -C 1
496 496 $ hg merge -r 2 --config "merge-tools.true.executable=python:$TESTTMP/my path/my working merge with spaces in filename.py:myworkingmergefn"
497 497 merging f
498 498 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
499 499 (branch merge, don't forget to commit)
500 500 $ aftermerge
501 501 # cat f
502 502 revision 1
503 503 space
504 504 # hg stat
505 505 M f
506 506 # hg resolve --list
507 507 R f
508 508
509 509 #if unix-permissions
510 510
511 511 environment variables in true.executable are handled:
512 512
513 513 $ echo 'echo "custom merge tool"' > .hg/merge.sh
514 514 $ beforemerge
515 515 [merge-tools]
516 516 false.whatever=
517 517 true.priority=1
518 518 true.executable=cat
519 519 # hg update -C 1
520 520 $ hg --config merge-tools.true.executable='sh' \
521 521 > --config merge-tools.true.args=.hg/merge.sh \
522 522 > merge -r 2
523 523 merging f
524 524 custom merge tool
525 525 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
526 526 (branch merge, don't forget to commit)
527 527 $ aftermerge
528 528 # cat f
529 529 revision 1
530 530 space
531 531 # hg stat
532 532 M f
533 533 # hg resolve --list
534 534 R f
535 535
536 536 #endif
537 537
538 538 Tool selection and merge-patterns
539 539
540 540 merge-patterns specifies new tool false:
541 541
542 542 $ beforemerge
543 543 [merge-tools]
544 544 false.whatever=
545 545 true.priority=1
546 546 true.executable=cat
547 547 # hg update -C 1
548 548 $ hg merge -r 2 --config merge-patterns.f=false
549 549 merging f
550 550 merging f failed!
551 551 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
552 552 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
553 553 [1]
554 554 $ aftermerge
555 555 # cat f
556 556 revision 1
557 557 space
558 558 # hg stat
559 559 M f
560 560 ? f.orig
561 561 # hg resolve --list
562 562 U f
563 563
564 564 merge-patterns specifies executable not found in PATH and gets warning:
565 565
566 566 $ beforemerge
567 567 [merge-tools]
568 568 false.whatever=
569 569 true.priority=1
570 570 true.executable=cat
571 571 # hg update -C 1
572 572 $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistentmergetool
573 573 couldn't find merge tool true (for pattern f)
574 574 merging f
575 575 couldn't find merge tool true (for pattern f)
576 576 merging f failed!
577 577 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
578 578 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
579 579 [1]
580 580 $ aftermerge
581 581 # cat f
582 582 revision 1
583 583 space
584 584 # hg stat
585 585 M f
586 586 ? f.orig
587 587 # hg resolve --list
588 588 U f
589 589
590 590 merge-patterns specifies executable with bogus path and gets warning:
591 591
592 592 $ beforemerge
593 593 [merge-tools]
594 594 false.whatever=
595 595 true.priority=1
596 596 true.executable=cat
597 597 # hg update -C 1
598 598 $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/nonexistent/mergetool
599 599 couldn't find merge tool true (for pattern f)
600 600 merging f
601 601 couldn't find merge tool true (for pattern f)
602 602 merging f failed!
603 603 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
604 604 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
605 605 [1]
606 606 $ aftermerge
607 607 # cat f
608 608 revision 1
609 609 space
610 610 # hg stat
611 611 M f
612 612 ? f.orig
613 613 # hg resolve --list
614 614 U f
615 615
616 616 ui.merge overrules priority
617 617
618 618 ui.merge specifies false:
619 619
620 620 $ beforemerge
621 621 [merge-tools]
622 622 false.whatever=
623 623 true.priority=1
624 624 true.executable=cat
625 625 # hg update -C 1
626 626 $ hg merge -r 2 --config ui.merge=false
627 627 merging f
628 628 merging f failed!
629 629 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
630 630 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
631 631 [1]
632 632 $ aftermerge
633 633 # cat f
634 634 revision 1
635 635 space
636 636 # hg stat
637 637 M f
638 638 ? f.orig
639 639 # hg resolve --list
640 640 U f
641 641
642 642 ui.merge specifies internal:fail:
643 643
644 644 $ beforemerge
645 645 [merge-tools]
646 646 false.whatever=
647 647 true.priority=1
648 648 true.executable=cat
649 649 # hg update -C 1
650 650 $ hg merge -r 2 --config ui.merge=internal:fail
651 651 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
652 652 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
653 653 [1]
654 654 $ aftermerge
655 655 # cat f
656 656 revision 1
657 657 space
658 658 # hg stat
659 659 M f
660 660 # hg resolve --list
661 661 U f
662 662
663 663 ui.merge specifies :local (without internal prefix):
664 664
665 665 $ beforemerge
666 666 [merge-tools]
667 667 false.whatever=
668 668 true.priority=1
669 669 true.executable=cat
670 670 # hg update -C 1
671 671 $ hg merge -r 2 --config ui.merge=:local
672 672 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
673 673 (branch merge, don't forget to commit)
674 674 $ aftermerge
675 675 # cat f
676 676 revision 1
677 677 space
678 678 # hg stat
679 679 M f
680 680 # hg resolve --list
681 681 R f
682 682
683 683 ui.merge specifies internal:other:
684 684
685 685 $ beforemerge
686 686 [merge-tools]
687 687 false.whatever=
688 688 true.priority=1
689 689 true.executable=cat
690 690 # hg update -C 1
691 691 $ hg merge -r 2 --config ui.merge=internal:other
692 692 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
693 693 (branch merge, don't forget to commit)
694 694 $ aftermerge
695 695 # cat f
696 696 revision 2
697 697 space
698 698 # hg stat
699 699 M f
700 700 # hg resolve --list
701 701 R f
702 702
703 703 ui.merge specifies internal:prompt:
704 704
705 705 $ beforemerge
706 706 [merge-tools]
707 707 false.whatever=
708 708 true.priority=1
709 709 true.executable=cat
710 710 # hg update -C 1
711 711 $ hg merge -r 2 --config ui.merge=internal:prompt
712 712 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? u
713 713 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
714 714 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
715 715 [1]
716 716 $ aftermerge
717 717 # cat f
718 718 revision 1
719 719 space
720 720 # hg stat
721 721 M f
722 722 # hg resolve --list
723 723 U f
724 724
725 725 ui.merge specifies :prompt, with 'leave unresolved' chosen
726 726
727 727 $ beforemerge
728 728 [merge-tools]
729 729 false.whatever=
730 730 true.priority=1
731 731 true.executable=cat
732 732 # hg update -C 1
733 733 $ hg merge -r 2 --config ui.merge=:prompt --config ui.interactive=True << EOF
734 734 > u
735 735 > EOF
736 736 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? u
737 737 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
738 738 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
739 739 [1]
740 740 $ aftermerge
741 741 # cat f
742 742 revision 1
743 743 space
744 744 # hg stat
745 745 M f
746 746 # hg resolve --list
747 747 U f
748 748
749 749 prompt with EOF
750 750
751 751 $ beforemerge
752 752 [merge-tools]
753 753 false.whatever=
754 754 true.priority=1
755 755 true.executable=cat
756 756 # hg update -C 1
757 757 $ hg merge -r 2 --config ui.merge=internal:prompt --config ui.interactive=true
758 758 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f?
759 759 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
760 760 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
761 761 [1]
762 762 $ aftermerge
763 763 # cat f
764 764 revision 1
765 765 space
766 766 # hg stat
767 767 M f
768 768 # hg resolve --list
769 769 U f
770 770 $ hg resolve --all --config ui.merge=internal:prompt --config ui.interactive=true
771 771 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f?
772 772 [1]
773 773 $ aftermerge
774 774 # cat f
775 775 revision 1
776 776 space
777 777 # hg stat
778 778 M f
779 779 ? f.orig
780 780 # hg resolve --list
781 781 U f
782 782 $ rm f
783 783 $ hg resolve --all --config ui.merge=internal:prompt --config ui.interactive=true
784 784 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f?
785 785 [1]
786 786 $ aftermerge
787 787 # cat f
788 788 revision 1
789 789 space
790 790 # hg stat
791 791 M f
792 792 # hg resolve --list
793 793 U f
794 794 $ hg resolve --all --config ui.merge=internal:prompt
795 795 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? u
796 796 [1]
797 797 $ aftermerge
798 798 # cat f
799 799 revision 1
800 800 space
801 801 # hg stat
802 802 M f
803 803 ? f.orig
804 804 # hg resolve --list
805 805 U f
806 806
807 807 ui.merge specifies internal:dump:
808 808
809 809 $ beforemerge
810 810 [merge-tools]
811 811 false.whatever=
812 812 true.priority=1
813 813 true.executable=cat
814 814 # hg update -C 1
815 815 $ hg merge -r 2 --config ui.merge=internal:dump
816 816 merging f
817 817 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
818 818 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
819 819 [1]
820 820 $ aftermerge
821 821 # cat f
822 822 revision 1
823 823 space
824 824 # hg stat
825 825 M f
826 826 ? f.base
827 827 ? f.local
828 828 ? f.orig
829 829 ? f.other
830 830 # hg resolve --list
831 831 U f
832 832
833 833 f.base:
834 834
835 835 $ cat f.base
836 836 revision 0
837 837 space
838 838
839 839 f.local:
840 840
841 841 $ cat f.local
842 842 revision 1
843 843 space
844 844
845 845 f.other:
846 846
847 847 $ cat f.other
848 848 revision 2
849 849 space
850 850 $ rm f.base f.local f.other
851 851
852 852 check that internal:dump doesn't dump files if premerge runs
853 853 successfully
854 854
855 855 $ beforemerge
856 856 [merge-tools]
857 857 false.whatever=
858 858 true.priority=1
859 859 true.executable=cat
860 860 # hg update -C 1
861 861 $ hg merge -r 3 --config ui.merge=internal:dump
862 862 merging f
863 863 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
864 864 (branch merge, don't forget to commit)
865 865
866 866 $ aftermerge
867 867 # cat f
868 868 revision 1
869 869 space
870 870 revision 3
871 871 # hg stat
872 872 M f
873 873 # hg resolve --list
874 874 R f
875 875
876 876 check that internal:forcedump dumps files, even if local and other can
877 877 be merged easily
878 878
879 879 $ beforemerge
880 880 [merge-tools]
881 881 false.whatever=
882 882 true.priority=1
883 883 true.executable=cat
884 884 # hg update -C 1
885 885 $ hg merge -r 3 --config ui.merge=internal:forcedump
886 886 merging f
887 887 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
888 888 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
889 889 [1]
890 890 $ aftermerge
891 891 # cat f
892 892 revision 1
893 893 space
894 894 # hg stat
895 895 M f
896 896 ? f.base
897 897 ? f.local
898 898 ? f.orig
899 899 ? f.other
900 900 # hg resolve --list
901 901 U f
902 902
903 903 $ cat f.base
904 904 revision 0
905 905 space
906 906
907 907 $ cat f.local
908 908 revision 1
909 909 space
910 910
911 911 $ cat f.other
912 912 revision 0
913 913 space
914 914 revision 3
915 915
916 916 $ rm -f f.base f.local f.other
917 917
918 918 ui.merge specifies internal:other but is overruled by pattern for false:
919 919
920 920 $ beforemerge
921 921 [merge-tools]
922 922 false.whatever=
923 923 true.priority=1
924 924 true.executable=cat
925 925 # hg update -C 1
926 926 $ hg merge -r 2 --config ui.merge=internal:other --config merge-patterns.f=false
927 927 merging f
928 928 merging f failed!
929 929 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
930 930 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
931 931 [1]
932 932 $ aftermerge
933 933 # cat f
934 934 revision 1
935 935 space
936 936 # hg stat
937 937 M f
938 938 ? f.orig
939 939 # hg resolve --list
940 940 U f
941 941
942 942 Premerge
943 943
944 944 ui.merge specifies internal:other but is overruled by --tool=false
945 945
946 946 $ beforemerge
947 947 [merge-tools]
948 948 false.whatever=
949 949 true.priority=1
950 950 true.executable=cat
951 951 # hg update -C 1
952 952 $ hg merge -r 2 --config ui.merge=internal:other --tool=false
953 953 merging f
954 954 merging f failed!
955 955 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
956 956 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
957 957 [1]
958 958 $ aftermerge
959 959 # cat f
960 960 revision 1
961 961 space
962 962 # hg stat
963 963 M f
964 964 ? f.orig
965 965 # hg resolve --list
966 966 U f
967 967
968 968 HGMERGE specifies internal:other but is overruled by --tool=false
969 969
970 970 $ HGMERGE=internal:other ; export HGMERGE
971 971 $ beforemerge
972 972 [merge-tools]
973 973 false.whatever=
974 974 true.priority=1
975 975 true.executable=cat
976 976 # hg update -C 1
977 977 $ hg merge -r 2 --tool=false
978 978 merging f
979 979 merging f failed!
980 980 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
981 981 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
982 982 [1]
983 983 $ aftermerge
984 984 # cat f
985 985 revision 1
986 986 space
987 987 # hg stat
988 988 M f
989 989 ? f.orig
990 990 # hg resolve --list
991 991 U f
992 992
993 993 $ unset HGMERGE # make sure HGMERGE doesn't interfere with remaining tests
994 994
995 995 update is a merge ...
996 996
997 997 (this also tests that files reverted with '--rev REV' are treated as
998 998 "modified", even if none of mode, size and timestamp of them isn't
999 999 changed on the filesystem (see also issue4583))
1000 1000
1001 1001 $ cat >> $HGRCPATH <<EOF
1002 1002 > [fakedirstatewritetime]
1003 1003 > # emulate invoking dirstate.write() via repo.status()
1004 1004 > # at 2000-01-01 00:00
1005 1005 > fakenow = 200001010000
1006 1006 > EOF
1007 1007
1008 1008 $ beforemerge
1009 1009 [merge-tools]
1010 1010 false.whatever=
1011 1011 true.priority=1
1012 1012 true.executable=cat
1013 1013 # hg update -C 1
1014 1014 $ hg update -q 0
1015 1015 $ f -s f
1016 1016 f: size=17
1017 1017 $ touch -t 200001010000 f
1018 1018 $ hg debugrebuildstate
1019 1019 $ cat >> $HGRCPATH <<EOF
1020 1020 > [extensions]
1021 1021 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
1022 1022 > EOF
1023 1023 $ hg revert -q -r 1 .
1024 1024 $ cat >> $HGRCPATH <<EOF
1025 1025 > [extensions]
1026 1026 > fakedirstatewritetime = !
1027 1027 > EOF
1028 1028 $ f -s f
1029 1029 f: size=17
1030 1030 $ touch -t 200001010000 f
1031 1031 $ hg status f
1032 1032 M f
1033 1033 $ hg update -r 2
1034 1034 merging f
1035 1035 revision 1
1036 1036 space
1037 1037 revision 0
1038 1038 space
1039 1039 revision 2
1040 1040 space
1041 1041 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1042 1042 $ aftermerge
1043 1043 # cat f
1044 1044 revision 1
1045 1045 space
1046 1046 # hg stat
1047 1047 M f
1048 1048 # hg resolve --list
1049 1049 R f
1050 1050
1051 1051 update should also have --tool
1052 1052
1053 1053 $ beforemerge
1054 1054 [merge-tools]
1055 1055 false.whatever=
1056 1056 true.priority=1
1057 1057 true.executable=cat
1058 1058 # hg update -C 1
1059 1059 $ hg update -q 0
1060 1060 $ f -s f
1061 1061 f: size=17
1062 1062 $ touch -t 200001010000 f
1063 1063 $ hg debugrebuildstate
1064 1064 $ cat >> $HGRCPATH <<EOF
1065 1065 > [extensions]
1066 1066 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
1067 1067 > EOF
1068 1068 $ hg revert -q -r 1 .
1069 1069 $ cat >> $HGRCPATH <<EOF
1070 1070 > [extensions]
1071 1071 > fakedirstatewritetime = !
1072 1072 > EOF
1073 1073 $ f -s f
1074 1074 f: size=17
1075 1075 $ touch -t 200001010000 f
1076 1076 $ hg status f
1077 1077 M f
1078 1078 $ hg update -r 2 --tool false
1079 1079 merging f
1080 1080 merging f failed!
1081 1081 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1082 1082 use 'hg resolve' to retry unresolved file merges
1083 1083 [1]
1084 1084 $ aftermerge
1085 1085 # cat f
1086 1086 revision 1
1087 1087 space
1088 1088 # hg stat
1089 1089 M f
1090 1090 ? f.orig
1091 1091 # hg resolve --list
1092 1092 U f
1093 1093
1094 1094 Default is silent simplemerge:
1095 1095
1096 1096 $ beforemerge
1097 1097 [merge-tools]
1098 1098 false.whatever=
1099 1099 true.priority=1
1100 1100 true.executable=cat
1101 1101 # hg update -C 1
1102 1102 $ hg merge -r 3
1103 1103 merging f
1104 1104 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1105 1105 (branch merge, don't forget to commit)
1106 1106 $ aftermerge
1107 1107 # cat f
1108 1108 revision 1
1109 1109 space
1110 1110 revision 3
1111 1111 # hg stat
1112 1112 M f
1113 1113 # hg resolve --list
1114 1114 R f
1115 1115
1116 1116 .premerge=True is same:
1117 1117
1118 1118 $ beforemerge
1119 1119 [merge-tools]
1120 1120 false.whatever=
1121 1121 true.priority=1
1122 1122 true.executable=cat
1123 1123 # hg update -C 1
1124 1124 $ hg merge -r 3 --config merge-tools.true.premerge=True
1125 1125 merging f
1126 1126 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1127 1127 (branch merge, don't forget to commit)
1128 1128 $ aftermerge
1129 1129 # cat f
1130 1130 revision 1
1131 1131 space
1132 1132 revision 3
1133 1133 # hg stat
1134 1134 M f
1135 1135 # hg resolve --list
1136 1136 R f
1137 1137
1138 1138 .premerge=False executes merge-tool:
1139 1139
1140 1140 $ beforemerge
1141 1141 [merge-tools]
1142 1142 false.whatever=
1143 1143 true.priority=1
1144 1144 true.executable=cat
1145 1145 # hg update -C 1
1146 1146 $ hg merge -r 3 --config merge-tools.true.premerge=False
1147 1147 merging f
1148 1148 revision 1
1149 1149 space
1150 1150 revision 0
1151 1151 space
1152 1152 revision 0
1153 1153 space
1154 1154 revision 3
1155 1155 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1156 1156 (branch merge, don't forget to commit)
1157 1157 $ aftermerge
1158 1158 # cat f
1159 1159 revision 1
1160 1160 space
1161 1161 # hg stat
1162 1162 M f
1163 1163 # hg resolve --list
1164 1164 R f
1165 1165
1166 1166 premerge=keep keeps conflict markers in:
1167 1167
1168 1168 $ beforemerge
1169 1169 [merge-tools]
1170 1170 false.whatever=
1171 1171 true.priority=1
1172 1172 true.executable=cat
1173 1173 # hg update -C 1
1174 1174 $ hg merge -r 4 --config merge-tools.true.premerge=keep
1175 1175 merging f
1176 1176 <<<<<<< working copy: ef83787e2614 - test: revision 1
1177 1177 revision 1
1178 1178 space
1179 1179 =======
1180 1180 revision 4
1181 1181 >>>>>>> merge rev: 81448d39c9a0 - test: revision 4
1182 1182 revision 0
1183 1183 space
1184 1184 revision 4
1185 1185 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1186 1186 (branch merge, don't forget to commit)
1187 1187 $ aftermerge
1188 1188 # cat f
1189 1189 <<<<<<< working copy: ef83787e2614 - test: revision 1
1190 1190 revision 1
1191 1191 space
1192 1192 =======
1193 1193 revision 4
1194 1194 >>>>>>> merge rev: 81448d39c9a0 - test: revision 4
1195 1195 # hg stat
1196 1196 M f
1197 1197 # hg resolve --list
1198 1198 R f
1199 1199
1200 1200 premerge=keep-merge3 keeps conflict markers with base content:
1201 1201
1202 1202 $ beforemerge
1203 1203 [merge-tools]
1204 1204 false.whatever=
1205 1205 true.priority=1
1206 1206 true.executable=cat
1207 1207 # hg update -C 1
1208 1208 $ hg merge -r 4 --config merge-tools.true.premerge=keep-merge3
1209 1209 merging f
1210 1210 <<<<<<< working copy: ef83787e2614 - test: revision 1
1211 1211 revision 1
1212 1212 space
1213 1213 ||||||| base
1214 1214 revision 0
1215 1215 space
1216 1216 =======
1217 1217 revision 4
1218 1218 >>>>>>> merge rev: 81448d39c9a0 - test: revision 4
1219 1219 revision 0
1220 1220 space
1221 1221 revision 4
1222 1222 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1223 1223 (branch merge, don't forget to commit)
1224 1224 $ aftermerge
1225 1225 # cat f
1226 1226 <<<<<<< working copy: ef83787e2614 - test: revision 1
1227 1227 revision 1
1228 1228 space
1229 1229 ||||||| base
1230 1230 revision 0
1231 1231 space
1232 1232 =======
1233 1233 revision 4
1234 1234 >>>>>>> merge rev: 81448d39c9a0 - test: revision 4
1235 1235 # hg stat
1236 1236 M f
1237 1237 # hg resolve --list
1238 1238 R f
1239 1239
1240 1240 premerge=keep respects ui.mergemarkers=basic:
1241 1241
1242 1242 $ beforemerge
1243 1243 [merge-tools]
1244 1244 false.whatever=
1245 1245 true.priority=1
1246 1246 true.executable=cat
1247 1247 # hg update -C 1
1248 1248 $ hg merge -r 4 --config merge-tools.true.premerge=keep --config ui.mergemarkers=basic
1249 1249 merging f
1250 1250 <<<<<<< working copy
1251 1251 revision 1
1252 1252 space
1253 1253 =======
1254 1254 revision 4
1255 1255 >>>>>>> merge rev
1256 1256 revision 0
1257 1257 space
1258 1258 revision 4
1259 1259 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1260 1260 (branch merge, don't forget to commit)
1261 1261 $ aftermerge
1262 1262 # cat f
1263 1263 <<<<<<< working copy
1264 1264 revision 1
1265 1265 space
1266 1266 =======
1267 1267 revision 4
1268 1268 >>>>>>> merge rev
1269 1269 # hg stat
1270 1270 M f
1271 1271 # hg resolve --list
1272 1272 R f
1273 1273
1274 1274 premerge=keep ignores ui.mergemarkers=basic if true.mergemarkers=detailed:
1275 1275
1276 1276 $ beforemerge
1277 1277 [merge-tools]
1278 1278 false.whatever=
1279 1279 true.priority=1
1280 1280 true.executable=cat
1281 1281 # hg update -C 1
1282 1282 $ hg merge -r 4 --config merge-tools.true.premerge=keep \
1283 1283 > --config ui.mergemarkers=basic \
1284 1284 > --config merge-tools.true.mergemarkers=detailed
1285 1285 merging f
1286 1286 <<<<<<< working copy: ef83787e2614 - test: revision 1
1287 1287 revision 1
1288 1288 space
1289 1289 =======
1290 1290 revision 4
1291 1291 >>>>>>> merge rev: 81448d39c9a0 - test: revision 4
1292 1292 revision 0
1293 1293 space
1294 1294 revision 4
1295 1295 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1296 1296 (branch merge, don't forget to commit)
1297 1297 $ aftermerge
1298 1298 # cat f
1299 1299 <<<<<<< working copy: ef83787e2614 - test: revision 1
1300 1300 revision 1
1301 1301 space
1302 1302 =======
1303 1303 revision 4
1304 1304 >>>>>>> merge rev: 81448d39c9a0 - test: revision 4
1305 1305 # hg stat
1306 1306 M f
1307 1307 # hg resolve --list
1308 1308 R f
1309 1309
1310 1310 premerge=keep respects ui.mergemarkertemplate instead of
1311 1311 true.mergemarkertemplate if true.mergemarkers=basic:
1312 1312
1313 1313 $ beforemerge
1314 1314 [merge-tools]
1315 1315 false.whatever=
1316 1316 true.priority=1
1317 1317 true.executable=cat
1318 1318 # hg update -C 1
1319 1319 $ hg merge -r 4 --config merge-tools.true.premerge=keep \
1320 1320 > --config ui.mergemarkertemplate='uitmpl {rev}' \
1321 1321 > --config merge-tools.true.mergemarkertemplate='tooltmpl {short(node)}'
1322 1322 merging f
1323 1323 <<<<<<< working copy: uitmpl 1
1324 1324 revision 1
1325 1325 space
1326 1326 =======
1327 1327 revision 4
1328 1328 >>>>>>> merge rev: uitmpl 4
1329 1329 revision 0
1330 1330 space
1331 1331 revision 4
1332 1332 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1333 1333 (branch merge, don't forget to commit)
1334 1334 $ aftermerge
1335 1335 # cat f
1336 1336 <<<<<<< working copy: uitmpl 1
1337 1337 revision 1
1338 1338 space
1339 1339 =======
1340 1340 revision 4
1341 1341 >>>>>>> merge rev: uitmpl 4
1342 1342 # hg stat
1343 1343 M f
1344 1344 # hg resolve --list
1345 1345 R f
1346 1346
1347 1347 premerge=keep respects true.mergemarkertemplate instead of
1348 1348 true.mergemarkertemplate if true.mergemarkers=detailed:
1349 1349
1350 1350 $ beforemerge
1351 1351 [merge-tools]
1352 1352 false.whatever=
1353 1353 true.priority=1
1354 1354 true.executable=cat
1355 1355 # hg update -C 1
1356 1356 $ hg merge -r 4 --config merge-tools.true.premerge=keep \
1357 1357 > --config ui.mergemarkertemplate='uitmpl {rev}' \
1358 1358 > --config merge-tools.true.mergemarkertemplate='tooltmpl {short(node)}' \
1359 1359 > --config merge-tools.true.mergemarkers=detailed
1360 1360 merging f
1361 1361 <<<<<<< working copy: tooltmpl ef83787e2614
1362 1362 revision 1
1363 1363 space
1364 1364 =======
1365 1365 revision 4
1366 1366 >>>>>>> merge rev: tooltmpl 81448d39c9a0
1367 1367 revision 0
1368 1368 space
1369 1369 revision 4
1370 1370 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1371 1371 (branch merge, don't forget to commit)
1372 1372 $ aftermerge
1373 1373 # cat f
1374 1374 <<<<<<< working copy: tooltmpl ef83787e2614
1375 1375 revision 1
1376 1376 space
1377 1377 =======
1378 1378 revision 4
1379 1379 >>>>>>> merge rev: tooltmpl 81448d39c9a0
1380 1380 # hg stat
1381 1381 M f
1382 1382 # hg resolve --list
1383 1383 R f
1384 1384
1385 1385 Tool execution
1386 1386
1387 1387 set tools.args explicit to include $base $local $other $output:
1388 1388
1389 1389 $ beforemerge
1390 1390 [merge-tools]
1391 1391 false.whatever=
1392 1392 true.priority=1
1393 1393 true.executable=cat
1394 1394 # hg update -C 1
1395 1395 $ hg merge -r 2 --config merge-tools.true.executable=head --config merge-tools.true.args='$base $local $other $output' \
1396 1396 > | sed 's,==> .* <==,==> ... <==,g'
1397 1397 merging f
1398 1398 ==> ... <==
1399 1399 revision 0
1400 1400 space
1401 1401
1402 1402 ==> ... <==
1403 1403 revision 1
1404 1404 space
1405 1405
1406 1406 ==> ... <==
1407 1407 revision 2
1408 1408 space
1409 1409
1410 1410 ==> ... <==
1411 1411 revision 1
1412 1412 space
1413 1413 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1414 1414 (branch merge, don't forget to commit)
1415 1415 $ aftermerge
1416 1416 # cat f
1417 1417 revision 1
1418 1418 space
1419 1419 # hg stat
1420 1420 M f
1421 1421 # hg resolve --list
1422 1422 R f
1423 1423
1424 1424 Merge with "echo mergeresult > $local":
1425 1425
1426 1426 $ beforemerge
1427 1427 [merge-tools]
1428 1428 false.whatever=
1429 1429 true.priority=1
1430 1430 true.executable=cat
1431 1431 # hg update -C 1
1432 1432 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $local'
1433 1433 merging f
1434 1434 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1435 1435 (branch merge, don't forget to commit)
1436 1436 $ aftermerge
1437 1437 # cat f
1438 1438 mergeresult
1439 1439 # hg stat
1440 1440 M f
1441 1441 # hg resolve --list
1442 1442 R f
1443 1443
1444 1444 - and $local is the file f:
1445 1445
1446 1446 $ beforemerge
1447 1447 [merge-tools]
1448 1448 false.whatever=
1449 1449 true.priority=1
1450 1450 true.executable=cat
1451 1451 # hg update -C 1
1452 1452 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > f'
1453 1453 merging f
1454 1454 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1455 1455 (branch merge, don't forget to commit)
1456 1456 $ aftermerge
1457 1457 # cat f
1458 1458 mergeresult
1459 1459 # hg stat
1460 1460 M f
1461 1461 # hg resolve --list
1462 1462 R f
1463 1463
1464 1464 Merge with "echo mergeresult > $output" - the variable is a bit magic:
1465 1465
1466 1466 $ beforemerge
1467 1467 [merge-tools]
1468 1468 false.whatever=
1469 1469 true.priority=1
1470 1470 true.executable=cat
1471 1471 # hg update -C 1
1472 1472 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $output'
1473 1473 merging f
1474 1474 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1475 1475 (branch merge, don't forget to commit)
1476 1476 $ aftermerge
1477 1477 # cat f
1478 1478 mergeresult
1479 1479 # hg stat
1480 1480 M f
1481 1481 # hg resolve --list
1482 1482 R f
1483 1483
1484 1484 Merge using tool with a path that must be quoted:
1485 1485
1486 1486 $ beforemerge
1487 1487 [merge-tools]
1488 1488 false.whatever=
1489 1489 true.priority=1
1490 1490 true.executable=cat
1491 1491 # hg update -C 1
1492 1492 $ cat <<EOF > 'my merge tool'
1493 1493 > cat "\$1" "\$2" "\$3" > "\$4"
1494 1494 > EOF
1495 1495 $ hg --config merge-tools.true.executable='sh' \
1496 1496 > --config merge-tools.true.args='"./my merge tool" $base $local $other $output' \
1497 1497 > merge -r 2
1498 1498 merging f
1499 1499 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1500 1500 (branch merge, don't forget to commit)
1501 1501 $ rm -f 'my merge tool'
1502 1502 $ aftermerge
1503 1503 # cat f
1504 1504 revision 0
1505 1505 space
1506 1506 revision 1
1507 1507 space
1508 1508 revision 2
1509 1509 space
1510 1510 # hg stat
1511 1511 M f
1512 1512 # hg resolve --list
1513 1513 R f
1514 1514
1515 1515 Merge using a tool that supports labellocal, labelother, and labelbase, checking
1516 1516 that they're quoted properly as well. This is using the default 'basic'
1517 1517 mergemarkers even though ui.mergemarkers is 'detailed', so it's ignoring both
1518 1518 mergemarkertemplate settings:
1519 1519
1520 1520 $ beforemerge
1521 1521 [merge-tools]
1522 1522 false.whatever=
1523 1523 true.priority=1
1524 1524 true.executable=cat
1525 1525 # hg update -C 1
1526 1526 $ cat <<EOF > printargs_merge_tool
1527 1527 > while test \$# -gt 0; do echo arg: \"\$1\"; shift; done
1528 1528 > EOF
1529 1529 $ hg --config merge-tools.true.executable='sh' \
1530 1530 > --config merge-tools.true.args='./printargs_merge_tool ll:$labellocal lo: $labelother lb:$labelbase": "$base' \
1531 1531 > --config merge-tools.true.mergemarkertemplate='tooltmpl {short(node)}' \
1532 1532 > --config ui.mergemarkertemplate='uitmpl {rev}' \
1533 1533 > --config ui.mergemarkers=detailed \
1534 1534 > merge -r 2
1535 1535 merging f
1536 1536 arg: "ll:working copy"
1537 1537 arg: "lo:"
1538 1538 arg: "merge rev"
1539 1539 arg: "lb:base: */f~base.*" (glob)
1540 1540 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1541 1541 (branch merge, don't forget to commit)
1542 1542 $ rm -f 'printargs_merge_tool'
1543 1543
1544 1544 Same test with experimental.mergetempdirprefix set:
1545 1545
1546 1546 $ beforemerge
1547 1547 [merge-tools]
1548 1548 false.whatever=
1549 1549 true.priority=1
1550 1550 true.executable=cat
1551 1551 # hg update -C 1
1552 1552 $ cat <<EOF > printargs_merge_tool
1553 1553 > while test \$# -gt 0; do echo arg: \"\$1\"; shift; done
1554 1554 > EOF
1555 1555 $ hg --config experimental.mergetempdirprefix=$TESTTMP/hgmerge. \
1556 1556 > --config merge-tools.true.executable='sh' \
1557 1557 > --config merge-tools.true.args='./printargs_merge_tool ll:$labellocal lo: $labelother lb:$labelbase": "$base' \
1558 1558 > --config merge-tools.true.mergemarkertemplate='tooltmpl {short(node)}' \
1559 1559 > --config ui.mergemarkertemplate='uitmpl {rev}' \
1560 1560 > --config ui.mergemarkers=detailed \
1561 1561 > merge -r 2
1562 1562 merging f
1563 1563 arg: "ll:working copy"
1564 1564 arg: "lo:"
1565 1565 arg: "merge rev"
1566 1566 arg: "lb:base: */hgmerge.*/f~base" (glob)
1567 1567 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1568 1568 (branch merge, don't forget to commit)
1569 1569 $ rm -f 'printargs_merge_tool'
1570 1570
1571 1571 Merge using a tool that supports labellocal, labelother, and labelbase, checking
1572 1572 that they're quoted properly as well. This is using 'detailed' mergemarkers,
1573 1573 even though ui.mergemarkers is 'basic', and using the tool's
1574 1574 mergemarkertemplate:
1575 1575
1576 1576 $ beforemerge
1577 1577 [merge-tools]
1578 1578 false.whatever=
1579 1579 true.priority=1
1580 1580 true.executable=cat
1581 1581 # hg update -C 1
1582 1582 $ cat <<EOF > printargs_merge_tool
1583 1583 > while test \$# -gt 0; do echo arg: \"\$1\"; shift; done
1584 1584 > EOF
1585 1585 $ hg --config merge-tools.true.executable='sh' \
1586 1586 > --config merge-tools.true.args='./printargs_merge_tool ll:$labellocal lo: $labelother lb:$labelbase": "$base' \
1587 1587 > --config merge-tools.true.mergemarkers=detailed \
1588 1588 > --config merge-tools.true.mergemarkertemplate='tooltmpl {short(node)}' \
1589 1589 > --config ui.mergemarkertemplate='uitmpl {rev}' \
1590 1590 > --config ui.mergemarkers=basic \
1591 1591 > merge -r 2
1592 1592 merging f
1593 1593 arg: "ll:working copy: tooltmpl ef83787e2614"
1594 1594 arg: "lo:"
1595 1595 arg: "merge rev: tooltmpl 0185f4e0cf02"
1596 1596 arg: "lb:base: */f~base.*" (glob)
1597 1597 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1598 1598 (branch merge, don't forget to commit)
1599 1599 $ rm -f 'printargs_merge_tool'
1600 1600
1601 1601 The merge tool still gets labellocal and labelother as 'basic' even when
1602 1602 premerge=keep is used and has 'detailed' markers:
1603 1603
1604 1604 $ beforemerge
1605 1605 [merge-tools]
1606 1606 false.whatever=
1607 1607 true.priority=1
1608 1608 true.executable=cat
1609 1609 # hg update -C 1
1610 1610 $ cat <<EOF > mytool
1611 1611 > echo labellocal: \"\$1\"
1612 1612 > echo labelother: \"\$2\"
1613 1613 > echo "output (arg)": \"\$3\"
1614 1614 > echo "output (contents)":
1615 1615 > cat "\$3"
1616 1616 > EOF
1617 1617 $ hg --config merge-tools.true.executable='sh' \
1618 1618 > --config merge-tools.true.args='mytool $labellocal $labelother $output' \
1619 1619 > --config merge-tools.true.premerge=keep \
1620 1620 > --config merge-tools.true.mergemarkertemplate='tooltmpl {short(node)}' \
1621 1621 > --config ui.mergemarkertemplate='uitmpl {rev}' \
1622 1622 > --config ui.mergemarkers=detailed \
1623 1623 > merge -r 2
1624 1624 merging f
1625 1625 labellocal: "working copy"
1626 1626 labelother: "merge rev"
1627 1627 output (arg): "$TESTTMP/repo/f"
1628 1628 output (contents):
1629 1629 <<<<<<< working copy: uitmpl 1
1630 1630 revision 1
1631 1631 =======
1632 1632 revision 2
1633 1633 >>>>>>> merge rev: uitmpl 2
1634 1634 space
1635 1635 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1636 1636 (branch merge, don't forget to commit)
1637 1637 $ rm -f 'mytool'
1638 1638
1639 1639 premerge=keep uses the *tool's* mergemarkertemplate if tool's
1640 1640 mergemarkers=detailed; labellocal and labelother also use the tool's template
1641 1641
1642 1642 $ beforemerge
1643 1643 [merge-tools]
1644 1644 false.whatever=
1645 1645 true.priority=1
1646 1646 true.executable=cat
1647 1647 # hg update -C 1
1648 1648 $ cat <<EOF > mytool
1649 1649 > echo labellocal: \"\$1\"
1650 1650 > echo labelother: \"\$2\"
1651 1651 > echo "output (arg)": \"\$3\"
1652 1652 > echo "output (contents)":
1653 1653 > cat "\$3"
1654 1654 > EOF
1655 1655 $ hg --config merge-tools.true.executable='sh' \
1656 1656 > --config merge-tools.true.args='mytool $labellocal $labelother $output' \
1657 1657 > --config merge-tools.true.premerge=keep \
1658 1658 > --config merge-tools.true.mergemarkers=detailed \
1659 1659 > --config merge-tools.true.mergemarkertemplate='tooltmpl {short(node)}' \
1660 1660 > --config ui.mergemarkertemplate='uitmpl {rev}' \
1661 1661 > --config ui.mergemarkers=detailed \
1662 1662 > merge -r 2
1663 1663 merging f
1664 1664 labellocal: "working copy: tooltmpl ef83787e2614"
1665 1665 labelother: "merge rev: tooltmpl 0185f4e0cf02"
1666 1666 output (arg): "$TESTTMP/repo/f"
1667 1667 output (contents):
1668 1668 <<<<<<< working copy: tooltmpl ef83787e2614
1669 1669 revision 1
1670 1670 =======
1671 1671 revision 2
1672 1672 >>>>>>> merge rev: tooltmpl 0185f4e0cf02
1673 1673 space
1674 1674 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1675 1675 (branch merge, don't forget to commit)
1676 1676 $ rm -f 'mytool'
1677 1677
1678 1678 Issue3581: Merging a filename that needs to be quoted
1679 1679 (This test doesn't work on Windows filesystems even on Linux, so check
1680 1680 for Unix-like permission)
1681 1681
1682 1682 #if unix-permissions
1683 1683 $ beforemerge
1684 1684 [merge-tools]
1685 1685 false.whatever=
1686 1686 true.priority=1
1687 1687 true.executable=cat
1688 1688 # hg update -C 1
1689 1689 $ echo "revision 5" > '"; exit 1; echo "'
1690 1690 $ hg commit -Am "revision 5"
1691 1691 adding "; exit 1; echo "
1692 1692 warning: filename contains '"', which is reserved on Windows: '"; exit 1; echo "'
1693 1693 $ hg update -C 1 > /dev/null
1694 1694 $ echo "revision 6" > '"; exit 1; echo "'
1695 1695 $ hg commit -Am "revision 6"
1696 1696 adding "; exit 1; echo "
1697 1697 warning: filename contains '"', which is reserved on Windows: '"; exit 1; echo "'
1698 1698 created new head
1699 1699 $ hg merge --config merge-tools.true.executable="true" -r 5
1700 1700 merging "; exit 1; echo "
1701 1701 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1702 1702 (branch merge, don't forget to commit)
1703 1703 $ hg update -C 1 > /dev/null
1704 1704 #endif
1705 1705
1706 1706 Merge post-processing
1707 1707
1708 1708 cat is a bad merge-tool and doesn't change:
1709 1709
1710 1710 $ beforemerge
1711 1711 [merge-tools]
1712 1712 false.whatever=
1713 1713 true.priority=1
1714 1714 true.executable=cat
1715 1715 # hg update -C 1
1716 1716 $ hg merge -y -r 2 --config merge-tools.true.checkchanged=1
1717 1717 merging f
1718 1718 revision 1
1719 1719 space
1720 1720 revision 0
1721 1721 space
1722 1722 revision 2
1723 1723 space
1724 1724 output file f appears unchanged
1725 1725 was merge successful (yn)? n
1726 1726 merging f failed!
1727 1727 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1728 1728 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
1729 1729 [1]
1730 1730 $ aftermerge
1731 1731 # cat f
1732 1732 revision 1
1733 1733 space
1734 1734 # hg stat
1735 1735 M f
1736 1736 ? f.orig
1737 1737 # hg resolve --list
1738 1738 U f
1739 1739
1740 missingbinary is a merge-tool that doesn't exist:
1741
1742 $ echo "missingbinary.executable=doesnotexist" >> .hg/hgrc
1743 $ beforemerge
1744 [merge-tools]
1745 false.whatever=
1746 true.priority=1
1747 true.executable=cat
1748 missingbinary.executable=doesnotexist
1749 # hg update -C 1
1750 $ hg merge -y -r 2 --config ui.merge=missingbinary
1751 merging f
1752 revision 1
1753 space
1754 revision 0
1755 space
1756 revision 2
1757 space
1758 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1759 (branch merge, don't forget to commit)
1760
1740 1761 #if symlink
1741 1762
1742 1763 internal merge cannot handle symlinks and shouldn't try:
1743 1764
1744 1765 $ hg update -q -C 1
1745 1766 $ rm f
1746 1767 $ ln -s symlink f
1747 1768 $ hg commit -qm 'f is symlink'
1748 1769 $ hg merge -r 2 --tool internal:merge
1749 1770 merging f
1750 1771 warning: internal :merge cannot merge symlinks for f
1751 1772 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
1752 1773 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1753 1774 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
1754 1775 [1]
1755 1776
1756 1777 #endif
1757 1778
1758 1779 Verify naming of temporary files and that extension is preserved:
1759 1780
1760 1781 $ hg update -q -C 1
1761 1782 $ hg mv f f.txt
1762 1783 $ hg ci -qm "f.txt"
1763 1784 $ hg update -q -C 2
1764 1785 $ hg merge -y -r tip --tool echo --config merge-tools.echo.args='$base $local $other $output'
1765 1786 merging f and f.txt to f.txt
1766 1787 */f~base.* */f~local.*.txt */f~other.*.txt $TESTTMP/repo/f.txt (glob)
1767 1788 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1768 1789 (branch merge, don't forget to commit)
1769 1790
1770 1791 Verify naming of temporary files and that extension is preserved
1771 1792 (experimental.mergetempdirprefix version):
1772 1793
1773 1794 $ hg update -q -C 1
1774 1795 $ hg mv f f.txt
1775 1796 $ hg ci -qm "f.txt"
1776 1797 $ hg update -q -C 2
1777 1798 $ hg merge -y -r tip --tool echo \
1778 1799 > --config merge-tools.echo.args='$base $local $other $output' \
1779 1800 > --config experimental.mergetempdirprefix=$TESTTMP/hgmerge.
1780 1801 merging f and f.txt to f.txt
1781 1802 $TESTTMP/hgmerge.*/f~base $TESTTMP/hgmerge.*/f~local.txt $TESTTMP/hgmerge.*/f~other.txt $TESTTMP/repo/f.txt (glob)
1782 1803 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1783 1804 (branch merge, don't forget to commit)
1784 1805
1785 1806 Check that debugpicktool examines which merge tool is chosen for
1786 1807 specified file as expected
1787 1808
1788 1809 $ beforemerge
1789 1810 [merge-tools]
1790 1811 false.whatever=
1791 1812 true.priority=1
1792 1813 true.executable=cat
1814 missingbinary.executable=doesnotexist
1793 1815 # hg update -C 1
1794 1816
1795 1817 (default behavior: checking files in the working parent context)
1796 1818
1797 1819 $ hg manifest
1798 1820 f
1799 1821 $ hg debugpickmergetool
1800 1822 f = true
1801 1823
1802 1824 (-X/-I and file patterns limmit examination targets)
1803 1825
1804 1826 $ hg debugpickmergetool -X f
1805 1827 $ hg debugpickmergetool unknown
1806 1828 unknown: no such file in rev ef83787e2614
1807 1829
1808 1830 (--changedelete emulates merging change and delete)
1809 1831
1810 1832 $ hg debugpickmergetool --changedelete
1811 1833 f = :prompt
1812 1834
1813 1835 (-r REV causes checking files in specified revision)
1814 1836
1815 1837 $ hg manifest -r tip
1816 1838 f.txt
1817 1839 $ hg debugpickmergetool -r tip
1818 1840 f.txt = true
1819 1841
1820 1842 #if symlink
1821 1843
1822 1844 (symlink causes chosing :prompt)
1823 1845
1824 1846 $ hg debugpickmergetool -r 6d00b3726f6e
1825 1847 f = :prompt
1826 1848
1827 1849 #endif
1828 1850
1829 1851 (--verbose shows some configurations)
1830 1852
1831 1853 $ hg debugpickmergetool --tool foobar -v
1832 1854 with --tool 'foobar'
1833 1855 f = foobar
1834 1856
1835 1857 $ HGMERGE=false hg debugpickmergetool -v
1836 1858 with HGMERGE='false'
1837 1859 f = false
1838 1860
1839 1861 $ hg debugpickmergetool --config ui.merge=false -v
1840 1862 with ui.merge='false'
1841 1863 f = false
1842 1864
1843 1865 (--debug shows errors detected intermediately)
1844 1866
1845 1867 $ hg debugpickmergetool --config merge-patterns.f=true --config merge-tools.true.executable=nonexistentmergetool --debug f
1846 1868 couldn't find merge tool true (for pattern f)
1847 1869 couldn't find merge tool true
1848 1870 f = false
1849 1871
1850 1872 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now