##// END OF EJS Templates
test-merge-tools.t: add 'hg resolve --list' output to tests...
Siddharth Agarwal -
r26897:da1c706c default
parent child Browse files
Show More
@@ -1,1049 +1,1123
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 > echo "# hg resolve --list"
54 > hg resolve --list
53 55 > rm -f f.orig
54 56 > }
55 57
56 58 Tool selection
57 59
58 60 default is internal merge:
59 61
60 62 $ beforemerge
61 63 [merge-tools]
62 64 # hg update -C 1
63 65
64 66 hg merge -r 2
65 67 override $PATH to ensure hgmerge not visible; use $PYTHON in case we're
66 68 running from a devel copy, not a temp installation
67 69
68 70 $ PATH="$BINDIR:/usr/sbin" $PYTHON "$BINDIR"/hg merge -r 2
69 71 merging f
70 72 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
71 73 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
72 74 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
73 75 [1]
74 76 $ aftermerge
75 77 # cat f
76 78 <<<<<<< local: ef83787e2614 - test: revision 1
77 79 revision 1
78 80 =======
79 81 revision 2
80 82 >>>>>>> other: 0185f4e0cf02 - test: revision 2
81 83 space
82 84 # hg stat
83 85 M f
84 86 ? f.orig
87 # hg resolve --list
88 U f
85 89
86 90 simplest hgrc using false for merge:
87 91
88 92 $ echo "false.whatever=" >> .hg/hgrc
89 93 $ beforemerge
90 94 [merge-tools]
91 95 false.whatever=
92 96 # hg update -C 1
93 97 $ hg merge -r 2
94 98 merging f
95 99 merging f failed!
96 100 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
97 101 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
98 102 [1]
99 103 $ aftermerge
100 104 # cat f
101 105 revision 1
102 106 space
103 107 # hg stat
104 108 M f
105 109 ? f.orig
110 # hg resolve --list
111 U f
106 112
107 113 #if unix-permissions
108 114
109 115 unexecutable file in $PATH shouldn't be found:
110 116
111 117 $ echo "echo fail" > false
112 118 $ hg up -qC 1
113 119 $ PATH="`pwd`:$BINDIR:/usr/sbin" $PYTHON "$BINDIR"/hg merge -r 2
114 120 merging f
115 121 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
116 122 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
117 123 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
118 124 [1]
119 125 $ rm false
120 126
121 127 #endif
122 128
123 129 executable directory in $PATH shouldn't be found:
124 130
125 131 $ mkdir false
126 132 $ hg up -qC 1
127 133 $ PATH="`pwd`:$BINDIR:/usr/sbin" $PYTHON "$BINDIR"/hg merge -r 2
128 134 merging f
129 135 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
130 136 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
131 137 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
132 138 [1]
133 139 $ rmdir false
134 140
135 141 true with higher .priority gets precedence:
136 142
137 143 $ echo "true.priority=1" >> .hg/hgrc
138 144 $ beforemerge
139 145 [merge-tools]
140 146 false.whatever=
141 147 true.priority=1
142 148 # hg update -C 1
143 149 $ hg merge -r 2
144 150 merging f
145 151 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
146 152 (branch merge, don't forget to commit)
147 153 $ aftermerge
148 154 # cat f
149 155 revision 1
150 156 space
151 157 # hg stat
152 158 M f
159 # hg resolve --list
160 R f
153 161
154 162 unless lowered on command line:
155 163
156 164 $ beforemerge
157 165 [merge-tools]
158 166 false.whatever=
159 167 true.priority=1
160 168 # hg update -C 1
161 169 $ hg merge -r 2 --config merge-tools.true.priority=-7
162 170 merging f
163 171 merging f failed!
164 172 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
165 173 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
166 174 [1]
167 175 $ aftermerge
168 176 # cat f
169 177 revision 1
170 178 space
171 179 # hg stat
172 180 M f
173 181 ? f.orig
182 # hg resolve --list
183 U f
174 184
175 185 or false set higher on command line:
176 186
177 187 $ beforemerge
178 188 [merge-tools]
179 189 false.whatever=
180 190 true.priority=1
181 191 # hg update -C 1
182 192 $ hg merge -r 2 --config merge-tools.false.priority=117
183 193 merging f
184 194 merging f failed!
185 195 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
186 196 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
187 197 [1]
188 198 $ aftermerge
189 199 # cat f
190 200 revision 1
191 201 space
192 202 # hg stat
193 203 M f
194 204 ? f.orig
205 # hg resolve --list
206 U f
195 207
196 208 or true set to disabled:
197 209 $ beforemerge
198 210 [merge-tools]
199 211 false.whatever=
200 212 true.priority=1
201 213 # hg update -C 1
202 214 $ hg merge -r 2 --config merge-tools.true.disabled=yes
203 215 merging f
204 216 merging f failed!
205 217 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
206 218 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
207 219 [1]
208 220 $ aftermerge
209 221 # cat f
210 222 revision 1
211 223 space
212 224 # hg stat
213 225 M f
214 226 ? f.orig
227 # hg resolve --list
228 U f
215 229
216 230 or true.executable not found in PATH:
217 231
218 232 $ beforemerge
219 233 [merge-tools]
220 234 false.whatever=
221 235 true.priority=1
222 236 # hg update -C 1
223 237 $ hg merge -r 2 --config merge-tools.true.executable=nonexistentmergetool
224 238 merging f
225 239 merging f failed!
226 240 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
227 241 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
228 242 [1]
229 243 $ aftermerge
230 244 # cat f
231 245 revision 1
232 246 space
233 247 # hg stat
234 248 M f
235 249 ? f.orig
250 # hg resolve --list
251 U f
236 252
237 253 or true.executable with bogus path:
238 254
239 255 $ beforemerge
240 256 [merge-tools]
241 257 false.whatever=
242 258 true.priority=1
243 259 # hg update -C 1
244 260 $ hg merge -r 2 --config merge-tools.true.executable=/nonexistent/mergetool
245 261 merging f
246 262 merging f failed!
247 263 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
248 264 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
249 265 [1]
250 266 $ aftermerge
251 267 # cat f
252 268 revision 1
253 269 space
254 270 # hg stat
255 271 M f
256 272 ? f.orig
273 # hg resolve --list
274 U f
257 275
258 276 but true.executable set to cat found in PATH works:
259 277
260 278 $ echo "true.executable=cat" >> .hg/hgrc
261 279 $ beforemerge
262 280 [merge-tools]
263 281 false.whatever=
264 282 true.priority=1
265 283 true.executable=cat
266 284 # hg update -C 1
267 285 $ hg merge -r 2
268 286 merging f
269 287 revision 1
270 288 space
271 289 revision 0
272 290 space
273 291 revision 2
274 292 space
275 293 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
276 294 (branch merge, don't forget to commit)
277 295 $ aftermerge
278 296 # cat f
279 297 revision 1
280 298 space
281 299 # hg stat
282 300 M f
301 # hg resolve --list
302 R f
283 303
284 304 and true.executable set to cat with path works:
285 305
286 306 $ beforemerge
287 307 [merge-tools]
288 308 false.whatever=
289 309 true.priority=1
290 310 true.executable=cat
291 311 # hg update -C 1
292 312 $ hg merge -r 2 --config merge-tools.true.executable=cat
293 313 merging f
294 314 revision 1
295 315 space
296 316 revision 0
297 317 space
298 318 revision 2
299 319 space
300 320 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
301 321 (branch merge, don't forget to commit)
302 322 $ aftermerge
303 323 # cat f
304 324 revision 1
305 325 space
306 326 # hg stat
307 327 M f
328 # hg resolve --list
329 R f
308 330
309 331 #if unix-permissions
310 332
311 333 environment variables in true.executable are handled:
312 334
313 335 $ echo 'echo "custom merge tool"' > .hg/merge.sh
314 336 $ beforemerge
315 337 [merge-tools]
316 338 false.whatever=
317 339 true.priority=1
318 340 true.executable=cat
319 341 # hg update -C 1
320 342 $ hg --config merge-tools.true.executable='sh' \
321 343 > --config merge-tools.true.args=.hg/merge.sh \
322 344 > merge -r 2
323 345 merging f
324 346 custom merge tool
325 347 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
326 348 (branch merge, don't forget to commit)
327 349 $ aftermerge
328 350 # cat f
329 351 revision 1
330 352 space
331 353 # hg stat
332 354 M f
355 # hg resolve --list
356 R f
333 357
334 358 #endif
335 359
336 360 Tool selection and merge-patterns
337 361
338 362 merge-patterns specifies new tool false:
339 363
340 364 $ beforemerge
341 365 [merge-tools]
342 366 false.whatever=
343 367 true.priority=1
344 368 true.executable=cat
345 369 # hg update -C 1
346 370 $ hg merge -r 2 --config merge-patterns.f=false
347 371 merging f
348 372 merging f failed!
349 373 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
350 374 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
351 375 [1]
352 376 $ aftermerge
353 377 # cat f
354 378 revision 1
355 379 space
356 380 # hg stat
357 381 M f
358 382 ? f.orig
383 # hg resolve --list
384 U f
359 385
360 386 merge-patterns specifies executable not found in PATH and gets warning:
361 387
362 388 $ beforemerge
363 389 [merge-tools]
364 390 false.whatever=
365 391 true.priority=1
366 392 true.executable=cat
367 393 # hg update -C 1
368 394 $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistentmergetool
369 395 couldn't find merge tool true specified for f
370 396 merging f
371 397 couldn't find merge tool true specified for f
372 398 merging f failed!
373 399 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
374 400 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
375 401 [1]
376 402 $ aftermerge
377 403 # cat f
378 404 revision 1
379 405 space
380 406 # hg stat
381 407 M f
382 408 ? f.orig
409 # hg resolve --list
410 U f
383 411
384 412 merge-patterns specifies executable with bogus path and gets warning:
385 413
386 414 $ beforemerge
387 415 [merge-tools]
388 416 false.whatever=
389 417 true.priority=1
390 418 true.executable=cat
391 419 # hg update -C 1
392 420 $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/nonexistent/mergetool
393 421 couldn't find merge tool true specified for f
394 422 merging f
395 423 couldn't find merge tool true specified for f
396 424 merging f failed!
397 425 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
398 426 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
399 427 [1]
400 428 $ aftermerge
401 429 # cat f
402 430 revision 1
403 431 space
404 432 # hg stat
405 433 M f
406 434 ? f.orig
435 # hg resolve --list
436 U f
407 437
408 438 ui.merge overrules priority
409 439
410 440 ui.merge specifies false:
411 441
412 442 $ beforemerge
413 443 [merge-tools]
414 444 false.whatever=
415 445 true.priority=1
416 446 true.executable=cat
417 447 # hg update -C 1
418 448 $ hg merge -r 2 --config ui.merge=false
419 449 merging f
420 450 merging f failed!
421 451 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
422 452 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
423 453 [1]
424 454 $ aftermerge
425 455 # cat f
426 456 revision 1
427 457 space
428 458 # hg stat
429 459 M f
430 460 ? f.orig
461 # hg resolve --list
462 U f
431 463
432 464 ui.merge specifies internal:fail:
433 465
434 466 $ beforemerge
435 467 [merge-tools]
436 468 false.whatever=
437 469 true.priority=1
438 470 true.executable=cat
439 471 # hg update -C 1
440 472 $ hg merge -r 2 --config ui.merge=internal:fail
441 473 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
442 474 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
443 475 [1]
444 476 $ aftermerge
445 477 # cat f
446 478 revision 1
447 479 space
448 480 # hg stat
449 481 M f
482 # hg resolve --list
483 U f
450 484
451 485 ui.merge specifies :local (without internal prefix):
452 486
453 487 $ beforemerge
454 488 [merge-tools]
455 489 false.whatever=
456 490 true.priority=1
457 491 true.executable=cat
458 492 # hg update -C 1
459 493 $ hg merge -r 2 --config ui.merge=:local
460 494 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
461 495 (branch merge, don't forget to commit)
462 496 $ aftermerge
463 497 # cat f
464 498 revision 1
465 499 space
466 500 # hg stat
467 501 M f
502 # hg resolve --list
503 R f
468 504
469 505 ui.merge specifies internal:other:
470 506
471 507 $ beforemerge
472 508 [merge-tools]
473 509 false.whatever=
474 510 true.priority=1
475 511 true.executable=cat
476 512 # hg update -C 1
477 513 $ hg merge -r 2 --config ui.merge=internal:other
478 514 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
479 515 (branch merge, don't forget to commit)
480 516 $ aftermerge
481 517 # cat f
482 518 revision 2
483 519 space
484 520 # hg stat
485 521 M f
522 # hg resolve --list
523 R f
486 524
487 525 ui.merge specifies internal:prompt:
488 526
489 527 $ beforemerge
490 528 [merge-tools]
491 529 false.whatever=
492 530 true.priority=1
493 531 true.executable=cat
494 532 # hg update -C 1
495 533 $ hg merge -r 2 --config ui.merge=internal:prompt
496 534 no tool found to merge f
497 535 keep (l)ocal or take (o)ther? l
498 536 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
499 537 (branch merge, don't forget to commit)
500 538 $ aftermerge
501 539 # cat f
502 540 revision 1
503 541 space
504 542 # hg stat
505 543 M f
544 # hg resolve --list
545 R f
506 546
507 547 ui.merge specifies internal:dump:
508 548
509 549 $ beforemerge
510 550 [merge-tools]
511 551 false.whatever=
512 552 true.priority=1
513 553 true.executable=cat
514 554 # hg update -C 1
515 555 $ hg merge -r 2 --config ui.merge=internal:dump
516 556 merging f
517 557 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
518 558 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
519 559 [1]
520 560 $ aftermerge
521 561 # cat f
522 562 revision 1
523 563 space
524 564 # hg stat
525 565 M f
526 566 ? f.base
527 567 ? f.local
528 568 ? f.orig
529 569 ? f.other
570 # hg resolve --list
571 U f
530 572
531 573 f.base:
532 574
533 575 $ cat f.base
534 576 revision 0
535 577 space
536 578
537 579 f.local:
538 580
539 581 $ cat f.local
540 582 revision 1
541 583 space
542 584
543 585 f.other:
544 586
545 587 $ cat f.other
546 588 revision 2
547 589 space
548 590 $ rm f.base f.local f.other
549 591
550 592 ui.merge specifies internal:other but is overruled by pattern for false:
551 593
552 594 $ beforemerge
553 595 [merge-tools]
554 596 false.whatever=
555 597 true.priority=1
556 598 true.executable=cat
557 599 # hg update -C 1
558 600 $ hg merge -r 2 --config ui.merge=internal:other --config merge-patterns.f=false
559 601 merging f
560 602 merging f failed!
561 603 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
562 604 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
563 605 [1]
564 606 $ aftermerge
565 607 # cat f
566 608 revision 1
567 609 space
568 610 # hg stat
569 611 M f
570 612 ? f.orig
613 # hg resolve --list
614 U f
571 615
572 616 Premerge
573 617
574 618 ui.merge specifies internal:other but is overruled by --tool=false
575 619
576 620 $ beforemerge
577 621 [merge-tools]
578 622 false.whatever=
579 623 true.priority=1
580 624 true.executable=cat
581 625 # hg update -C 1
582 626 $ hg merge -r 2 --config ui.merge=internal:other --tool=false
583 627 merging f
584 628 merging f failed!
585 629 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
586 630 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
587 631 [1]
588 632 $ aftermerge
589 633 # cat f
590 634 revision 1
591 635 space
592 636 # hg stat
593 637 M f
594 638 ? f.orig
639 # hg resolve --list
640 U f
595 641
596 642 HGMERGE specifies internal:other but is overruled by --tool=false
597 643
598 644 $ HGMERGE=internal:other ; export HGMERGE
599 645 $ beforemerge
600 646 [merge-tools]
601 647 false.whatever=
602 648 true.priority=1
603 649 true.executable=cat
604 650 # hg update -C 1
605 651 $ hg merge -r 2 --tool=false
606 652 merging f
607 653 merging f failed!
608 654 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
609 655 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
610 656 [1]
611 657 $ aftermerge
612 658 # cat f
613 659 revision 1
614 660 space
615 661 # hg stat
616 662 M f
617 663 ? f.orig
664 # hg resolve --list
665 U f
618 666
619 667 $ unset HGMERGE # make sure HGMERGE doesn't interfere with remaining tests
620 668
621 669 update is a merge ...
622 670
623 671 (this also tests that files reverted with '--rev REV' are treated as
624 672 "modified", even if none of mode, size and timestamp of them isn't
625 673 changed on the filesystem (see also issue4583))
626 674
627 675 $ cat >> $HGRCPATH <<EOF
628 676 > [fakedirstatewritetime]
629 677 > # emulate invoking dirstate.write() via repo.status()
630 678 > # at 2000-01-01 00:00
631 679 > fakenow = 200001010000
632 680 > EOF
633 681
634 682 $ beforemerge
635 683 [merge-tools]
636 684 false.whatever=
637 685 true.priority=1
638 686 true.executable=cat
639 687 # hg update -C 1
640 688 $ hg update -q 0
641 689 $ f -s f
642 690 f: size=17
643 691 $ touch -t 200001010000 f
644 692 $ hg debugrebuildstate
645 693 $ cat >> $HGRCPATH <<EOF
646 694 > [extensions]
647 695 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
648 696 > EOF
649 697 $ hg revert -q -r 1 .
650 698 $ cat >> $HGRCPATH <<EOF
651 699 > [extensions]
652 700 > fakedirstatewritetime = !
653 701 > EOF
654 702 $ f -s f
655 703 f: size=17
656 704 $ touch -t 200001010000 f
657 705 $ hg status f
658 706 M f
659 707 $ hg update -r 2
660 708 merging f
661 709 revision 1
662 710 space
663 711 revision 0
664 712 space
665 713 revision 2
666 714 space
667 715 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
668 716 $ aftermerge
669 717 # cat f
670 718 revision 1
671 719 space
672 720 # hg stat
673 721 M f
722 # hg resolve --list
723 R f
674 724
675 725 update should also have --tool
676 726
677 727 $ beforemerge
678 728 [merge-tools]
679 729 false.whatever=
680 730 true.priority=1
681 731 true.executable=cat
682 732 # hg update -C 1
683 733 $ hg update -q 0
684 734 $ f -s f
685 735 f: size=17
686 736 $ touch -t 200001010000 f
687 737 $ hg debugrebuildstate
688 738 $ cat >> $HGRCPATH <<EOF
689 739 > [extensions]
690 740 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
691 741 > EOF
692 742 $ hg revert -q -r 1 .
693 743 $ cat >> $HGRCPATH <<EOF
694 744 > [extensions]
695 745 > fakedirstatewritetime = !
696 746 > EOF
697 747 $ f -s f
698 748 f: size=17
699 749 $ touch -t 200001010000 f
700 750 $ hg status f
701 751 M f
702 752 $ hg update -r 2 --tool false
703 753 merging f
704 754 merging f failed!
705 755 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
706 756 use 'hg resolve' to retry unresolved file merges
707 757 [1]
708 758 $ aftermerge
709 759 # cat f
710 760 revision 1
711 761 space
712 762 # hg stat
713 763 M f
714 764 ? f.orig
765 # hg resolve --list
766 U f
715 767
716 768 Default is silent simplemerge:
717 769
718 770 $ beforemerge
719 771 [merge-tools]
720 772 false.whatever=
721 773 true.priority=1
722 774 true.executable=cat
723 775 # hg update -C 1
724 776 $ hg merge -r 3
725 777 merging f
726 778 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
727 779 (branch merge, don't forget to commit)
728 780 $ aftermerge
729 781 # cat f
730 782 revision 1
731 783 space
732 784 revision 3
733 785 # hg stat
734 786 M f
787 # hg resolve --list
788 R f
735 789
736 790 .premerge=True is same:
737 791
738 792 $ beforemerge
739 793 [merge-tools]
740 794 false.whatever=
741 795 true.priority=1
742 796 true.executable=cat
743 797 # hg update -C 1
744 798 $ hg merge -r 3 --config merge-tools.true.premerge=True
745 799 merging f
746 800 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
747 801 (branch merge, don't forget to commit)
748 802 $ aftermerge
749 803 # cat f
750 804 revision 1
751 805 space
752 806 revision 3
753 807 # hg stat
754 808 M f
809 # hg resolve --list
810 R f
755 811
756 812 .premerge=False executes merge-tool:
757 813
758 814 $ beforemerge
759 815 [merge-tools]
760 816 false.whatever=
761 817 true.priority=1
762 818 true.executable=cat
763 819 # hg update -C 1
764 820 $ hg merge -r 3 --config merge-tools.true.premerge=False
765 821 merging f
766 822 revision 1
767 823 space
768 824 revision 0
769 825 space
770 826 revision 0
771 827 space
772 828 revision 3
773 829 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
774 830 (branch merge, don't forget to commit)
775 831 $ aftermerge
776 832 # cat f
777 833 revision 1
778 834 space
779 835 # hg stat
780 836 M f
837 # hg resolve --list
838 R f
781 839
782 840 premerge=keep keeps conflict markers in:
783 841
784 842 $ beforemerge
785 843 [merge-tools]
786 844 false.whatever=
787 845 true.priority=1
788 846 true.executable=cat
789 847 # hg update -C 1
790 848 $ hg merge -r 4 --config merge-tools.true.premerge=keep
791 849 merging f
792 850 <<<<<<< local: ef83787e2614 - test: revision 1
793 851 revision 1
794 852 space
795 853 =======
796 854 revision 4
797 855 >>>>>>> other: 81448d39c9a0 - test: revision 4
798 856 revision 0
799 857 space
800 858 revision 4
801 859 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
802 860 (branch merge, don't forget to commit)
803 861 $ aftermerge
804 862 # cat f
805 863 <<<<<<< local: ef83787e2614 - test: revision 1
806 864 revision 1
807 865 space
808 866 =======
809 867 revision 4
810 868 >>>>>>> other: 81448d39c9a0 - test: revision 4
811 869 # hg stat
812 870 M f
871 # hg resolve --list
872 R f
813 873
814 874 premerge=keep-merge3 keeps conflict markers with base content:
815 875
816 876 $ beforemerge
817 877 [merge-tools]
818 878 false.whatever=
819 879 true.priority=1
820 880 true.executable=cat
821 881 # hg update -C 1
822 882 $ hg merge -r 4 --config merge-tools.true.premerge=keep-merge3
823 883 merging f
824 884 <<<<<<< local: ef83787e2614 - test: revision 1
825 885 revision 1
826 886 space
827 887 ||||||| base
828 888 revision 0
829 889 space
830 890 =======
831 891 revision 4
832 892 >>>>>>> other: 81448d39c9a0 - test: revision 4
833 893 revision 0
834 894 space
835 895 revision 4
836 896 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
837 897 (branch merge, don't forget to commit)
838 898 $ aftermerge
839 899 # cat f
840 900 <<<<<<< local: ef83787e2614 - test: revision 1
841 901 revision 1
842 902 space
843 903 ||||||| base
844 904 revision 0
845 905 space
846 906 =======
847 907 revision 4
848 908 >>>>>>> other: 81448d39c9a0 - test: revision 4
849 909 # hg stat
850 910 M f
911 # hg resolve --list
912 R f
851 913
852 914
853 915 Tool execution
854 916
855 917 set tools.args explicit to include $base $local $other $output:
856 918
857 919 $ beforemerge
858 920 [merge-tools]
859 921 false.whatever=
860 922 true.priority=1
861 923 true.executable=cat
862 924 # hg update -C 1
863 925 $ hg merge -r 2 --config merge-tools.true.executable=head --config merge-tools.true.args='$base $local $other $output' \
864 926 > | sed 's,==> .* <==,==> ... <==,g'
865 927 merging f
866 928 ==> ... <==
867 929 revision 0
868 930 space
869 931
870 932 ==> ... <==
871 933 revision 1
872 934 space
873 935
874 936 ==> ... <==
875 937 revision 2
876 938 space
877 939
878 940 ==> ... <==
879 941 revision 1
880 942 space
881 943 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
882 944 (branch merge, don't forget to commit)
883 945 $ aftermerge
884 946 # cat f
885 947 revision 1
886 948 space
887 949 # hg stat
888 950 M f
951 # hg resolve --list
952 R f
889 953
890 954 Merge with "echo mergeresult > $local":
891 955
892 956 $ beforemerge
893 957 [merge-tools]
894 958 false.whatever=
895 959 true.priority=1
896 960 true.executable=cat
897 961 # hg update -C 1
898 962 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $local'
899 963 merging f
900 964 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
901 965 (branch merge, don't forget to commit)
902 966 $ aftermerge
903 967 # cat f
904 968 mergeresult
905 969 # hg stat
906 970 M f
971 # hg resolve --list
972 R f
907 973
908 974 - and $local is the file f:
909 975
910 976 $ beforemerge
911 977 [merge-tools]
912 978 false.whatever=
913 979 true.priority=1
914 980 true.executable=cat
915 981 # hg update -C 1
916 982 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > f'
917 983 merging f
918 984 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
919 985 (branch merge, don't forget to commit)
920 986 $ aftermerge
921 987 # cat f
922 988 mergeresult
923 989 # hg stat
924 990 M f
991 # hg resolve --list
992 R f
925 993
926 994 Merge with "echo mergeresult > $output" - the variable is a bit magic:
927 995
928 996 $ beforemerge
929 997 [merge-tools]
930 998 false.whatever=
931 999 true.priority=1
932 1000 true.executable=cat
933 1001 # hg update -C 1
934 1002 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $output'
935 1003 merging f
936 1004 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
937 1005 (branch merge, don't forget to commit)
938 1006 $ aftermerge
939 1007 # cat f
940 1008 mergeresult
941 1009 # hg stat
942 1010 M f
1011 # hg resolve --list
1012 R f
943 1013
944 1014 Merge using tool with a path that must be quoted:
945 1015
946 1016 $ beforemerge
947 1017 [merge-tools]
948 1018 false.whatever=
949 1019 true.priority=1
950 1020 true.executable=cat
951 1021 # hg update -C 1
952 1022 $ cat <<EOF > 'my merge tool'
953 1023 > cat "\$1" "\$2" "\$3" > "\$4"
954 1024 > EOF
955 1025 $ hg --config merge-tools.true.executable='sh' \
956 1026 > --config merge-tools.true.args='"./my merge tool" $base $local $other $output' \
957 1027 > merge -r 2
958 1028 merging f
959 1029 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
960 1030 (branch merge, don't forget to commit)
961 1031 $ rm -f 'my merge tool'
962 1032 $ aftermerge
963 1033 # cat f
964 1034 revision 0
965 1035 space
966 1036 revision 1
967 1037 space
968 1038 revision 2
969 1039 space
970 1040 # hg stat
971 1041 M f
1042 # hg resolve --list
1043 R f
972 1044
973 1045 Issue3581: Merging a filename that needs to be quoted
974 1046 (This test doesn't work on Windows filesystems even on Linux, so check
975 1047 for Unix-like permission)
976 1048
977 1049 #if unix-permissions
978 1050 $ beforemerge
979 1051 [merge-tools]
980 1052 false.whatever=
981 1053 true.priority=1
982 1054 true.executable=cat
983 1055 # hg update -C 1
984 1056 $ echo "revision 5" > '"; exit 1; echo "'
985 1057 $ hg commit -Am "revision 5"
986 1058 adding "; exit 1; echo "
987 1059 warning: filename contains '"', which is reserved on Windows: '"; exit 1; echo "'
988 1060 $ hg update -C 1 > /dev/null
989 1061 $ echo "revision 6" > '"; exit 1; echo "'
990 1062 $ hg commit -Am "revision 6"
991 1063 adding "; exit 1; echo "
992 1064 warning: filename contains '"', which is reserved on Windows: '"; exit 1; echo "'
993 1065 created new head
994 1066 $ hg merge --config merge-tools.true.executable="true" -r 5
995 1067 merging "; exit 1; echo "
996 1068 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
997 1069 (branch merge, don't forget to commit)
998 1070 $ hg update -C 1 > /dev/null
999 1071 #endif
1000 1072
1001 1073 Merge post-processing
1002 1074
1003 1075 cat is a bad merge-tool and doesn't change:
1004 1076
1005 1077 $ beforemerge
1006 1078 [merge-tools]
1007 1079 false.whatever=
1008 1080 true.priority=1
1009 1081 true.executable=cat
1010 1082 # hg update -C 1
1011 1083 $ hg merge -y -r 2 --config merge-tools.true.checkchanged=1
1012 1084 merging f
1013 1085 revision 1
1014 1086 space
1015 1087 revision 0
1016 1088 space
1017 1089 revision 2
1018 1090 space
1019 1091 output file f appears unchanged
1020 1092 was merge successful (yn)? n
1021 1093 merging f failed!
1022 1094 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1023 1095 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
1024 1096 [1]
1025 1097 $ aftermerge
1026 1098 # cat f
1027 1099 revision 1
1028 1100 space
1029 1101 # hg stat
1030 1102 M f
1031 1103 ? f.orig
1104 # hg resolve --list
1105 U f
1032 1106
1033 1107 #if symlink
1034 1108
1035 1109 internal merge cannot handle symlinks and shouldn't try:
1036 1110
1037 1111 $ hg update -q -C 1
1038 1112 $ rm f
1039 1113 $ ln -s symlink f
1040 1114 $ hg commit -qm 'f is symlink'
1041 1115 $ hg merge -r 2 --tool internal:merge
1042 1116 merging f
1043 1117 warning: internal :merge cannot merge symlinks for f
1044 1118 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
1045 1119 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1046 1120 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
1047 1121 [1]
1048 1122
1049 1123 #endif
General Comments 0
You need to be logged in to leave comments. Login now