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