Show More
@@ -4529,10 +4529,16 b' def resolve(ui, repo, *pats, **opts):' | |||||
4529 | """ |
|
4529 | """ | |
4530 |
|
4530 | |||
4531 | opts = pycompat.byteskwargs(opts) |
|
4531 | opts = pycompat.byteskwargs(opts) | |
|
4532 | confirm = ui.configbool('commands', 'resolve.confirm') | |||
4532 | flaglist = 'all mark unmark list no_status'.split() |
|
4533 | flaglist = 'all mark unmark list no_status'.split() | |
4533 | all, mark, unmark, show, nostatus = \ |
|
4534 | all, mark, unmark, show, nostatus = \ | |
4534 | [opts.get(o) for o in flaglist] |
|
4535 | [opts.get(o) for o in flaglist] | |
4535 |
|
4536 | |||
|
4537 | if all and confirm: | |||
|
4538 | if ui.promptchoice(_(b're-merge all unresolved files (yn)?' | |||
|
4539 | b'$$ &Yes $$ &No')): | |||
|
4540 | raise error.Abort(_('user quit')) | |||
|
4541 | ||||
4536 | if (show and (mark or unmark)) or (mark and unmark): |
|
4542 | if (show and (mark or unmark)) or (mark and unmark): | |
4537 | raise error.Abort(_("too many options specified")) |
|
4543 | raise error.Abort(_("too many options specified")) | |
4538 | if pats and all: |
|
4544 | if pats and all: |
@@ -190,6 +190,9 b" coreconfigitem('color', 'pagermode'," | |||||
190 | coreconfigitem('commands', 'grep.all-files', |
|
190 | coreconfigitem('commands', 'grep.all-files', | |
191 | default=False, |
|
191 | default=False, | |
192 | ) |
|
192 | ) | |
|
193 | coreconfigitem('commands', 'resolve.confirm', | |||
|
194 | default=False, | |||
|
195 | ) | |||
193 | coreconfigitem('commands', 'show.aliasprefix', |
|
196 | coreconfigitem('commands', 'show.aliasprefix', | |
194 | default=list, |
|
197 | default=list, | |
195 | ) |
|
198 | ) |
@@ -438,6 +438,11 b' effect and style see :hg:`help color`.' | |||||
438 | ``commands`` |
|
438 | ``commands`` | |
439 | ------------ |
|
439 | ------------ | |
440 |
|
440 | |||
|
441 | ``resolve.confirm`` | |||
|
442 | Confirm before re-merging all unresolved files when running | |||
|
443 | :hg:`resolve --all`. | |||
|
444 | (default: False) | |||
|
445 | ||||
441 | ``status.relative`` |
|
446 | ``status.relative`` | |
442 | Make paths in :hg:`status` output relative to the current directory. |
|
447 | Make paths in :hg:`status` output relative to the current directory. | |
443 | (default: False) |
|
448 | (default: False) |
@@ -423,3 +423,92 b' If the file is already marked as resolve' | |||||
423 | R file2 |
|
423 | R file2 | |
424 |
|
424 | |||
425 | $ cd .. |
|
425 | $ cd .. | |
|
426 | ||||
|
427 | ====================================================== | |||
|
428 | Test 'hg resolve' confirm config option functionality | | |||
|
429 | ====================================================== | |||
|
430 | $ cat >> $HGRCPATH << EOF | |||
|
431 | > [extensions] | |||
|
432 | > rebase= | |||
|
433 | > EOF | |||
|
434 | ||||
|
435 | $ hg init repo2 | |||
|
436 | $ cd repo2 | |||
|
437 | ||||
|
438 | $ echo boss > boss | |||
|
439 | $ hg ci -Am "add boss" | |||
|
440 | adding boss | |||
|
441 | ||||
|
442 | $ for emp in emp1 emp2 emp3; do echo work > $emp; done; | |||
|
443 | $ hg ci -Aqm "added emp1 emp2 emp3" | |||
|
444 | ||||
|
445 | $ hg up 0 | |||
|
446 | 0 files updated, 0 files merged, 3 files removed, 0 files unresolved | |||
|
447 | ||||
|
448 | $ for emp in emp1 emp2 emp3; do echo nowork > $emp; done; | |||
|
449 | $ hg ci -Aqm "added lazy emp1 emp2 emp3" | |||
|
450 | ||||
|
451 | $ hg log -GT "{rev} {node|short} {firstline(desc)}\n" | |||
|
452 | @ 2 0acfd4a49af0 added lazy emp1 emp2 emp3 | |||
|
453 | | | |||
|
454 | | o 1 f30f98a8181f added emp1 emp2 emp3 | |||
|
455 | |/ | |||
|
456 | o 0 88660038d466 add boss | |||
|
457 | ||||
|
458 | $ hg rebase -s 1 -d 2 | |||
|
459 | rebasing 1:f30f98a8181f "added emp1 emp2 emp3" | |||
|
460 | merging emp1 | |||
|
461 | merging emp2 | |||
|
462 | merging emp3 | |||
|
463 | warning: conflicts while merging emp1! (edit, then use 'hg resolve --mark') | |||
|
464 | warning: conflicts while merging emp2! (edit, then use 'hg resolve --mark') | |||
|
465 | warning: conflicts while merging emp3! (edit, then use 'hg resolve --mark') | |||
|
466 | unresolved conflicts (see hg resolve, then hg rebase --continue) | |||
|
467 | [1] | |||
|
468 | ||||
|
469 | Test when commands.resolve.confirm config option is not set: | |||
|
470 | =========================================================== | |||
|
471 | $ hg resolve --all | |||
|
472 | merging emp1 | |||
|
473 | merging emp2 | |||
|
474 | merging emp3 | |||
|
475 | warning: conflicts while merging emp1! (edit, then use 'hg resolve --mark') | |||
|
476 | warning: conflicts while merging emp2! (edit, then use 'hg resolve --mark') | |||
|
477 | warning: conflicts while merging emp3! (edit, then use 'hg resolve --mark') | |||
|
478 | [1] | |||
|
479 | ||||
|
480 | Test when config option is set: | |||
|
481 | ============================== | |||
|
482 | $ cat >> $HGRCPATH << EOF | |||
|
483 | > [ui] | |||
|
484 | > interactive = True | |||
|
485 | > [commands] | |||
|
486 | > resolve.confirm = True | |||
|
487 | > EOF | |||
|
488 | ||||
|
489 | $ hg resolve | |||
|
490 | abort: no files or directories specified | |||
|
491 | (use --all to re-merge all unresolved files) | |||
|
492 | [255] | |||
|
493 | $ hg resolve --all << EOF | |||
|
494 | > n | |||
|
495 | > EOF | |||
|
496 | re-merge all unresolved files (yn)? n | |||
|
497 | abort: user quit | |||
|
498 | [255] | |||
|
499 | ||||
|
500 | $ hg resolve --all << EOF | |||
|
501 | > y | |||
|
502 | > EOF | |||
|
503 | re-merge all unresolved files (yn)? y | |||
|
504 | merging emp1 | |||
|
505 | merging emp2 | |||
|
506 | merging emp3 | |||
|
507 | warning: conflicts while merging emp1! (edit, then use 'hg resolve --mark') | |||
|
508 | warning: conflicts while merging emp2! (edit, then use 'hg resolve --mark') | |||
|
509 | warning: conflicts while merging emp3! (edit, then use 'hg resolve --mark') | |||
|
510 | [1] | |||
|
511 | ||||
|
512 | $ hg rebase --abort | |||
|
513 | rebase aborted | |||
|
514 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now