##// END OF EJS Templates
mergetools: add a test for premerge --keep...
Pierre-Yves David -
r22030:ecdff28d default
parent child Browse files
Show More
@@ -1,908 +1,941 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
5 5
6 6 revision 0
7 7
8 8 $ echo "revision 0" > f
9 9 $ echo "space" >> f
10 10 $ hg commit -Am "revision 0"
11 11 adding f
12 12
13 13 revision 1
14 14
15 15 $ echo "revision 1" > f
16 16 $ echo "space" >> f
17 17 $ hg commit -Am "revision 1"
18 18 $ hg update 0 > /dev/null
19 19
20 20 revision 2
21 21
22 22 $ echo "revision 2" > f
23 23 $ echo "space" >> f
24 24 $ hg commit -Am "revision 2"
25 25 created new head
26 26 $ hg update 0 > /dev/null
27 27
28 28 revision 3 - simple to merge
29 29
30 30 $ echo "revision 3" >> f
31 31 $ hg commit -Am "revision 3"
32 32 created new head
33 33
34 34 revision 4 - hard to merge
35 35
36 36 $ hg update 0 > /dev/null
37 37 $ echo "revision 4" > f
38 38 $ hg commit -Am "revision 4"
39 39 created new head
40 40
41 41 $ echo "[merge-tools]" > .hg/hgrc
42 42
43 43 $ beforemerge() {
44 44 > cat .hg/hgrc
45 45 > echo "# hg update -C 1"
46 46 > hg update -C 1 > /dev/null
47 47 > }
48 48 $ aftermerge() {
49 49 > echo "# cat f"
50 50 > cat f
51 51 > echo "# hg stat"
52 52 > hg stat
53 53 > rm -f f.orig
54 54 > }
55 55
56 56 Tool selection
57 57
58 58 default is internal merge:
59 59
60 60 $ beforemerge
61 61 [merge-tools]
62 62 # hg update -C 1
63 63
64 64 hg merge -r 2
65 65 override $PATH to ensure hgmerge not visible; use $PYTHON in case we're
66 66 running from a devel copy, not a temp installation
67 67
68 68 $ PATH="$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2
69 69 merging f
70 70 warning: conflicts during merge.
71 71 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
72 72 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
73 73 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
74 74 [1]
75 75 $ aftermerge
76 76 # cat f
77 77 <<<<<<< local: ef83787e2614 - test: revision 1
78 78 revision 1
79 79 =======
80 80 revision 2
81 81 >>>>>>> other: 0185f4e0cf02 - test: revision 2
82 82 space
83 83 # hg stat
84 84 M f
85 85 ? f.orig
86 86
87 87 simplest hgrc using false for merge:
88 88
89 89 $ echo "false.whatever=" >> .hg/hgrc
90 90 $ beforemerge
91 91 [merge-tools]
92 92 false.whatever=
93 93 # hg update -C 1
94 94 $ hg merge -r 2
95 95 merging f
96 96 merging f failed!
97 97 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
98 98 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
99 99 [1]
100 100 $ aftermerge
101 101 # cat f
102 102 revision 1
103 103 space
104 104 # hg stat
105 105 M f
106 106 ? f.orig
107 107
108 108 unexecutable file in $PATH shouldn't be found:
109 109
110 110 $ touch false
111 111 $ hg up -qC 1
112 112 $ PATH="`pwd`:$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2
113 113 merging f
114 114 warning: conflicts during merge.
115 115 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
116 116 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
117 117 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
118 118 [1]
119 119 $ rm false
120 120
121 121 executable directory in $PATH shouldn't be found:
122 122
123 123 $ mkdir false
124 124 $ hg up -qC 1
125 125 $ PATH="`pwd`:$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2
126 126 merging f
127 127 warning: conflicts during merge.
128 128 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
129 129 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
130 130 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
131 131 [1]
132 132 $ rmdir false
133 133
134 134 true with higher .priority gets precedence:
135 135
136 136 $ echo "true.priority=1" >> .hg/hgrc
137 137 $ beforemerge
138 138 [merge-tools]
139 139 false.whatever=
140 140 true.priority=1
141 141 # hg update -C 1
142 142 $ hg merge -r 2
143 143 merging f
144 144 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
145 145 (branch merge, don't forget to commit)
146 146 $ aftermerge
147 147 # cat f
148 148 revision 1
149 149 space
150 150 # hg stat
151 151 M f
152 152
153 153 unless lowered on command line:
154 154
155 155 $ beforemerge
156 156 [merge-tools]
157 157 false.whatever=
158 158 true.priority=1
159 159 # hg update -C 1
160 160 $ hg merge -r 2 --config merge-tools.true.priority=-7
161 161 merging f
162 162 merging f failed!
163 163 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
164 164 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
165 165 [1]
166 166 $ aftermerge
167 167 # cat f
168 168 revision 1
169 169 space
170 170 # hg stat
171 171 M f
172 172 ? f.orig
173 173
174 174 or false set higher on command line:
175 175
176 176 $ beforemerge
177 177 [merge-tools]
178 178 false.whatever=
179 179 true.priority=1
180 180 # hg update -C 1
181 181 $ hg merge -r 2 --config merge-tools.false.priority=117
182 182 merging f
183 183 merging f failed!
184 184 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
185 185 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
186 186 [1]
187 187 $ aftermerge
188 188 # cat f
189 189 revision 1
190 190 space
191 191 # hg stat
192 192 M f
193 193 ? f.orig
194 194
195 195 or true.executable not found in PATH:
196 196
197 197 $ beforemerge
198 198 [merge-tools]
199 199 false.whatever=
200 200 true.priority=1
201 201 # hg update -C 1
202 202 $ hg merge -r 2 --config merge-tools.true.executable=nonexistentmergetool
203 203 merging f
204 204 merging f failed!
205 205 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
206 206 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
207 207 [1]
208 208 $ aftermerge
209 209 # cat f
210 210 revision 1
211 211 space
212 212 # hg stat
213 213 M f
214 214 ? f.orig
215 215
216 216 or true.executable with bogus path:
217 217
218 218 $ beforemerge
219 219 [merge-tools]
220 220 false.whatever=
221 221 true.priority=1
222 222 # hg update -C 1
223 223 $ hg merge -r 2 --config merge-tools.true.executable=/nonexistent/mergetool
224 224 merging f
225 225 merging f failed!
226 226 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
227 227 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
228 228 [1]
229 229 $ aftermerge
230 230 # cat f
231 231 revision 1
232 232 space
233 233 # hg stat
234 234 M f
235 235 ? f.orig
236 236
237 237 but true.executable set to cat found in PATH works:
238 238
239 239 $ echo "true.executable=cat" >> .hg/hgrc
240 240 $ beforemerge
241 241 [merge-tools]
242 242 false.whatever=
243 243 true.priority=1
244 244 true.executable=cat
245 245 # hg update -C 1
246 246 $ hg merge -r 2
247 247 merging f
248 248 revision 1
249 249 space
250 250 revision 0
251 251 space
252 252 revision 2
253 253 space
254 254 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
255 255 (branch merge, don't forget to commit)
256 256 $ aftermerge
257 257 # cat f
258 258 revision 1
259 259 space
260 260 # hg stat
261 261 M f
262 262
263 263 and true.executable set to cat with path works:
264 264
265 265 $ beforemerge
266 266 [merge-tools]
267 267 false.whatever=
268 268 true.priority=1
269 269 true.executable=cat
270 270 # hg update -C 1
271 271 $ hg merge -r 2 --config merge-tools.true.executable=cat
272 272 merging f
273 273 revision 1
274 274 space
275 275 revision 0
276 276 space
277 277 revision 2
278 278 space
279 279 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
280 280 (branch merge, don't forget to commit)
281 281 $ aftermerge
282 282 # cat f
283 283 revision 1
284 284 space
285 285 # hg stat
286 286 M f
287 287
288 288 #if unix-permissions
289 289
290 290 environment variables in true.executable are handled:
291 291
292 292 $ echo 'echo "custom merge tool"' > .hg/merge.sh
293 293 $ beforemerge
294 294 [merge-tools]
295 295 false.whatever=
296 296 true.priority=1
297 297 true.executable=cat
298 298 # hg update -C 1
299 299 $ hg --config merge-tools.true.executable='sh' \
300 300 > --config merge-tools.true.args=.hg/merge.sh \
301 301 > merge -r 2
302 302 merging f
303 303 custom merge tool
304 304 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
305 305 (branch merge, don't forget to commit)
306 306 $ aftermerge
307 307 # cat f
308 308 revision 1
309 309 space
310 310 # hg stat
311 311 M f
312 312
313 313 #endif
314 314
315 315 Tool selection and merge-patterns
316 316
317 317 merge-patterns specifies new tool false:
318 318
319 319 $ beforemerge
320 320 [merge-tools]
321 321 false.whatever=
322 322 true.priority=1
323 323 true.executable=cat
324 324 # hg update -C 1
325 325 $ hg merge -r 2 --config merge-patterns.f=false
326 326 merging f
327 327 merging f failed!
328 328 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
329 329 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
330 330 [1]
331 331 $ aftermerge
332 332 # cat f
333 333 revision 1
334 334 space
335 335 # hg stat
336 336 M f
337 337 ? f.orig
338 338
339 339 merge-patterns specifies executable not found in PATH and gets warning:
340 340
341 341 $ beforemerge
342 342 [merge-tools]
343 343 false.whatever=
344 344 true.priority=1
345 345 true.executable=cat
346 346 # hg update -C 1
347 347 $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistentmergetool
348 348 couldn't find merge tool true specified for f
349 349 merging f
350 350 merging f failed!
351 351 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
352 352 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
353 353 [1]
354 354 $ aftermerge
355 355 # cat f
356 356 revision 1
357 357 space
358 358 # hg stat
359 359 M f
360 360 ? f.orig
361 361
362 362 merge-patterns specifies executable with bogus path and gets warning:
363 363
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-patterns.f=true --config merge-tools.true.executable=/nonexistent/mergetool
371 371 couldn't find merge tool true specified for f
372 372 merging f
373 373 merging f failed!
374 374 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
375 375 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
376 376 [1]
377 377 $ aftermerge
378 378 # cat f
379 379 revision 1
380 380 space
381 381 # hg stat
382 382 M f
383 383 ? f.orig
384 384
385 385 ui.merge overrules priority
386 386
387 387 ui.merge specifies false:
388 388
389 389 $ beforemerge
390 390 [merge-tools]
391 391 false.whatever=
392 392 true.priority=1
393 393 true.executable=cat
394 394 # hg update -C 1
395 395 $ hg merge -r 2 --config ui.merge=false
396 396 merging f
397 397 merging f failed!
398 398 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
399 399 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
400 400 [1]
401 401 $ aftermerge
402 402 # cat f
403 403 revision 1
404 404 space
405 405 # hg stat
406 406 M f
407 407 ? f.orig
408 408
409 409 ui.merge specifies internal:fail:
410 410
411 411 $ beforemerge
412 412 [merge-tools]
413 413 false.whatever=
414 414 true.priority=1
415 415 true.executable=cat
416 416 # hg update -C 1
417 417 $ hg merge -r 2 --config ui.merge=internal:fail
418 418 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
419 419 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
420 420 [1]
421 421 $ aftermerge
422 422 # cat f
423 423 revision 1
424 424 space
425 425 # hg stat
426 426 M f
427 427
428 428 ui.merge specifies internal:local:
429 429
430 430 $ beforemerge
431 431 [merge-tools]
432 432 false.whatever=
433 433 true.priority=1
434 434 true.executable=cat
435 435 # hg update -C 1
436 436 $ hg merge -r 2 --config ui.merge=internal:local
437 437 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
438 438 (branch merge, don't forget to commit)
439 439 $ aftermerge
440 440 # cat f
441 441 revision 1
442 442 space
443 443 # hg stat
444 444 M f
445 445
446 446 ui.merge specifies internal:other:
447 447
448 448 $ beforemerge
449 449 [merge-tools]
450 450 false.whatever=
451 451 true.priority=1
452 452 true.executable=cat
453 453 # hg update -C 1
454 454 $ hg merge -r 2 --config ui.merge=internal:other
455 455 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
456 456 (branch merge, don't forget to commit)
457 457 $ aftermerge
458 458 # cat f
459 459 revision 2
460 460 space
461 461 # hg stat
462 462 M f
463 463
464 464 ui.merge specifies internal:prompt:
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 ui.merge=internal:prompt
473 473 no tool found to merge f
474 474 keep (l)ocal or take (o)ther? l
475 475 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
476 476 (branch merge, don't forget to commit)
477 477 $ aftermerge
478 478 # cat f
479 479 revision 1
480 480 space
481 481 # hg stat
482 482 M f
483 483
484 484 ui.merge specifies internal:dump:
485 485
486 486 $ beforemerge
487 487 [merge-tools]
488 488 false.whatever=
489 489 true.priority=1
490 490 true.executable=cat
491 491 # hg update -C 1
492 492 $ hg merge -r 2 --config ui.merge=internal:dump
493 493 merging f
494 494 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
495 495 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
496 496 [1]
497 497 $ aftermerge
498 498 # cat f
499 499 revision 1
500 500 space
501 501 # hg stat
502 502 M f
503 503 ? f.base
504 504 ? f.local
505 505 ? f.orig
506 506 ? f.other
507 507
508 508 f.base:
509 509
510 510 $ cat f.base
511 511 revision 0
512 512 space
513 513
514 514 f.local:
515 515
516 516 $ cat f.local
517 517 revision 1
518 518 space
519 519
520 520 f.other:
521 521
522 522 $ cat f.other
523 523 revision 2
524 524 space
525 525 $ rm f.base f.local f.other
526 526
527 527 ui.merge specifies internal:other but is overruled by pattern for false:
528 528
529 529 $ beforemerge
530 530 [merge-tools]
531 531 false.whatever=
532 532 true.priority=1
533 533 true.executable=cat
534 534 # hg update -C 1
535 535 $ hg merge -r 2 --config ui.merge=internal:other --config merge-patterns.f=false
536 536 merging f
537 537 merging f failed!
538 538 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
539 539 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
540 540 [1]
541 541 $ aftermerge
542 542 # cat f
543 543 revision 1
544 544 space
545 545 # hg stat
546 546 M f
547 547 ? f.orig
548 548
549 549 Premerge
550 550
551 551 ui.merge specifies internal:other but is overruled by --tool=false
552 552
553 553 $ beforemerge
554 554 [merge-tools]
555 555 false.whatever=
556 556 true.priority=1
557 557 true.executable=cat
558 558 # hg update -C 1
559 559 $ hg merge -r 2 --config ui.merge=internal:other --tool=false
560 560 merging f
561 561 merging f failed!
562 562 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
563 563 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
564 564 [1]
565 565 $ aftermerge
566 566 # cat f
567 567 revision 1
568 568 space
569 569 # hg stat
570 570 M f
571 571 ? f.orig
572 572
573 573 HGMERGE specifies internal:other but is overruled by --tool=false
574 574
575 575 $ HGMERGE=internal:other ; export HGMERGE
576 576 $ beforemerge
577 577 [merge-tools]
578 578 false.whatever=
579 579 true.priority=1
580 580 true.executable=cat
581 581 # hg update -C 1
582 582 $ hg merge -r 2 --tool=false
583 583 merging f
584 584 merging f failed!
585 585 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
586 586 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
587 587 [1]
588 588 $ aftermerge
589 589 # cat f
590 590 revision 1
591 591 space
592 592 # hg stat
593 593 M f
594 594 ? f.orig
595 595
596 596 $ unset HGMERGE # make sure HGMERGE doesn't interfere with remaining tests
597 597
598 598 update is a merge ...
599 599
600 600 $ beforemerge
601 601 [merge-tools]
602 602 false.whatever=
603 603 true.priority=1
604 604 true.executable=cat
605 605 # hg update -C 1
606 606 $ hg debugsetparent 0
607 607 $ hg update -r 2
608 608 merging f
609 609 revision 1
610 610 space
611 611 revision 0
612 612 space
613 613 revision 2
614 614 space
615 615 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
616 616 $ aftermerge
617 617 # cat f
618 618 revision 1
619 619 space
620 620 # hg stat
621 621 M f
622 622
623 623 update should also have --tool
624 624
625 625 $ beforemerge
626 626 [merge-tools]
627 627 false.whatever=
628 628 true.priority=1
629 629 true.executable=cat
630 630 # hg update -C 1
631 631 $ hg debugsetparent 0
632 632 $ hg update -r 2 --tool false
633 633 merging f
634 634 merging f failed!
635 635 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
636 636 use 'hg resolve' to retry unresolved file merges
637 637 [1]
638 638 $ aftermerge
639 639 # cat f
640 640 revision 1
641 641 space
642 642 # hg stat
643 643 M f
644 644 ? f.orig
645 645
646 646 Default is silent simplemerge:
647 647
648 648 $ beforemerge
649 649 [merge-tools]
650 650 false.whatever=
651 651 true.priority=1
652 652 true.executable=cat
653 653 # hg update -C 1
654 654 $ hg merge -r 3
655 655 merging f
656 656 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
657 657 (branch merge, don't forget to commit)
658 658 $ aftermerge
659 659 # cat f
660 660 revision 1
661 661 space
662 662 revision 3
663 663 # hg stat
664 664 M f
665 665
666 666 .premerge=True is same:
667 667
668 668 $ beforemerge
669 669 [merge-tools]
670 670 false.whatever=
671 671 true.priority=1
672 672 true.executable=cat
673 673 # hg update -C 1
674 674 $ hg merge -r 3 --config merge-tools.true.premerge=True
675 675 merging f
676 676 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
677 677 (branch merge, don't forget to commit)
678 678 $ aftermerge
679 679 # cat f
680 680 revision 1
681 681 space
682 682 revision 3
683 683 # hg stat
684 684 M f
685 685
686 686 .premerge=False executes merge-tool:
687 687
688 688 $ beforemerge
689 689 [merge-tools]
690 690 false.whatever=
691 691 true.priority=1
692 692 true.executable=cat
693 693 # hg update -C 1
694 694 $ hg merge -r 3 --config merge-tools.true.premerge=False
695 695 merging f
696 696 revision 1
697 697 space
698 698 revision 0
699 699 space
700 700 revision 0
701 701 space
702 702 revision 3
703 703 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
704 704 (branch merge, don't forget to commit)
705 705 $ aftermerge
706 706 # cat f
707 707 revision 1
708 708 space
709 709 # hg stat
710 710 M f
711 711
712 premerge=keep keeps conflict markers in:
713
714 $ beforemerge
715 [merge-tools]
716 false.whatever=
717 true.priority=1
718 true.executable=cat
719 # hg update -C 1
720 $ hg merge -r 4 --config merge-tools.true.premerge=keep
721 merging f
722 <<<<<<< local: ef83787e2614 - test: revision 1
723 revision 1
724 space
725 =======
726 revision 4
727 >>>>>>> other: 81448d39c9a0 - test: revision 4
728 revision 0
729 space
730 revision 4
731 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
732 (branch merge, don't forget to commit)
733 $ aftermerge
734 # cat f
735 <<<<<<< local: ef83787e2614 - test: revision 1
736 revision 1
737 space
738 =======
739 revision 4
740 >>>>>>> other: 81448d39c9a0 - test: revision 4
741 # hg stat
742 M f
743
744
712 745 Tool execution
713 746
714 747 set tools.args explicit to include $base $local $other $output:
715 748
716 749 $ beforemerge
717 750 [merge-tools]
718 751 false.whatever=
719 752 true.priority=1
720 753 true.executable=cat
721 754 # hg update -C 1
722 755 $ hg merge -r 2 --config merge-tools.true.executable=head --config merge-tools.true.args='$base $local $other $output' \
723 756 > | sed 's,==> .* <==,==> ... <==,g'
724 757 merging f
725 758 ==> ... <==
726 759 revision 0
727 760 space
728 761
729 762 ==> ... <==
730 763 revision 1
731 764 space
732 765
733 766 ==> ... <==
734 767 revision 2
735 768 space
736 769
737 770 ==> ... <==
738 771 revision 1
739 772 space
740 773 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
741 774 (branch merge, don't forget to commit)
742 775 $ aftermerge
743 776 # cat f
744 777 revision 1
745 778 space
746 779 # hg stat
747 780 M f
748 781
749 782 Merge with "echo mergeresult > $local":
750 783
751 784 $ beforemerge
752 785 [merge-tools]
753 786 false.whatever=
754 787 true.priority=1
755 788 true.executable=cat
756 789 # hg update -C 1
757 790 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $local'
758 791 merging f
759 792 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
760 793 (branch merge, don't forget to commit)
761 794 $ aftermerge
762 795 # cat f
763 796 mergeresult
764 797 # hg stat
765 798 M f
766 799
767 800 - and $local is the file f:
768 801
769 802 $ beforemerge
770 803 [merge-tools]
771 804 false.whatever=
772 805 true.priority=1
773 806 true.executable=cat
774 807 # hg update -C 1
775 808 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > f'
776 809 merging f
777 810 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
778 811 (branch merge, don't forget to commit)
779 812 $ aftermerge
780 813 # cat f
781 814 mergeresult
782 815 # hg stat
783 816 M f
784 817
785 818 Merge with "echo mergeresult > $output" - the variable is a bit magic:
786 819
787 820 $ beforemerge
788 821 [merge-tools]
789 822 false.whatever=
790 823 true.priority=1
791 824 true.executable=cat
792 825 # hg update -C 1
793 826 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $output'
794 827 merging f
795 828 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
796 829 (branch merge, don't forget to commit)
797 830 $ aftermerge
798 831 # cat f
799 832 mergeresult
800 833 # hg stat
801 834 M f
802 835
803 836 Merge using tool with a path that must be quoted:
804 837
805 838 $ beforemerge
806 839 [merge-tools]
807 840 false.whatever=
808 841 true.priority=1
809 842 true.executable=cat
810 843 # hg update -C 1
811 844 $ cat <<EOF > 'my merge tool'
812 845 > cat "\$1" "\$2" "\$3" > "\$4"
813 846 > EOF
814 847 $ hg --config merge-tools.true.executable='sh' \
815 848 > --config merge-tools.true.args='"./my merge tool" $base $local $other $output' \
816 849 > merge -r 2
817 850 merging f
818 851 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
819 852 (branch merge, don't forget to commit)
820 853 $ rm -f 'my merge tool'
821 854 $ aftermerge
822 855 # cat f
823 856 revision 0
824 857 space
825 858 revision 1
826 859 space
827 860 revision 2
828 861 space
829 862 # hg stat
830 863 M f
831 864
832 865 Issue3581: Merging a filename that needs to be quoted
833 866 (This test doesn't work on Windows filesystems even on Linux, so check
834 867 for Unix-like permission)
835 868
836 869 #if unix-permissions
837 870 $ beforemerge
838 871 [merge-tools]
839 872 false.whatever=
840 873 true.priority=1
841 874 true.executable=cat
842 875 # hg update -C 1
843 876 $ echo "revision 5" > '"; exit 1; echo "'
844 877 $ hg commit -Am "revision 5"
845 878 adding "; exit 1; echo "
846 879 warning: filename contains '"', which is reserved on Windows: '"; exit 1; echo "'
847 880 $ hg update -C 1 > /dev/null
848 881 $ echo "revision 6" > '"; exit 1; echo "'
849 882 $ hg commit -Am "revision 6"
850 883 adding "; exit 1; echo "
851 884 warning: filename contains '"', which is reserved on Windows: '"; exit 1; echo "'
852 885 created new head
853 886 $ hg merge --config merge-tools.true.executable="true" -r 5
854 887 merging "; exit 1; echo "
855 888 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
856 889 (branch merge, don't forget to commit)
857 890 $ hg update -C 1 > /dev/null
858 891 #endif
859 892
860 893 Merge post-processing
861 894
862 895 cat is a bad merge-tool and doesn't change:
863 896
864 897 $ beforemerge
865 898 [merge-tools]
866 899 false.whatever=
867 900 true.priority=1
868 901 true.executable=cat
869 902 # hg update -C 1
870 903 $ hg merge -y -r 2 --config merge-tools.true.checkchanged=1
871 904 merging f
872 905 revision 1
873 906 space
874 907 revision 0
875 908 space
876 909 revision 2
877 910 space
878 911 output file f appears unchanged
879 912 was merge successful (yn)? n
880 913 merging f failed!
881 914 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
882 915 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
883 916 [1]
884 917 $ aftermerge
885 918 # cat f
886 919 revision 1
887 920 space
888 921 # hg stat
889 922 M f
890 923 ? f.orig
891 924
892 925 #if symlink
893 926
894 927 internal merge cannot handle symlinks and shouldn't try:
895 928
896 929 $ hg update -q -C 1
897 930 $ rm f
898 931 $ ln -s symlink f
899 932 $ hg commit -qm 'f is symlink'
900 933 $ hg merge -r 2 --tool internal:merge
901 934 merging f
902 935 warning: internal:merge cannot merge symlinks for f
903 936 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
904 937 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
905 938 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
906 939 [1]
907 940
908 941 #endif
General Comments 0
You need to be logged in to leave comments. Login now