Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 38955:49b51f41fb46
resolve: organize 'if confirm' conditionals
Differential Revision: https://phab.mercurial-scm.org/D4123
author | Sushil khanchi <sushilkhanchi97@gmail.com> |
---|---|
date | Mon, 06 Aug 2018 10:03:57 +0530 |
parents | f35f6791595f |
children | f3f109971359 |
comparison
equal
deleted
inserted
replaced
38954:fff675dfb80b | 38955:49b51f41fb46 |
---|---|
4532 confirm = ui.configbool('commands', 'resolve.confirm') | 4532 confirm = ui.configbool('commands', 'resolve.confirm') |
4533 flaglist = 'all mark unmark list no_status'.split() | 4533 flaglist = 'all mark unmark list no_status'.split() |
4534 all, mark, unmark, show, nostatus = \ | 4534 all, mark, unmark, show, nostatus = \ |
4535 [opts.get(o) for o in flaglist] | 4535 [opts.get(o) for o in flaglist] |
4536 | 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 | |
4542 if (show and (mark or unmark)) or (mark and unmark): | 4537 if (show and (mark or unmark)) or (mark and unmark): |
4543 raise error.Abort(_("too many options specified")) | 4538 raise error.Abort(_("too many options specified")) |
4544 if pats and all: | 4539 if pats and all: |
4545 raise error.Abort(_("can't specify --all and patterns")) | 4540 raise error.Abort(_("can't specify --all and patterns")) |
4546 if not (all or pats or show or mark or unmark): | 4541 if not (all or pats or show or mark or unmark): |
4547 raise error.Abort(_('no files or directories specified'), | 4542 raise error.Abort(_('no files or directories specified'), |
4548 hint=('use --all to re-merge all unresolved files')) | 4543 hint=('use --all to re-merge all unresolved files')) |
4549 | 4544 |
4550 if mark and confirm and not pats: | 4545 if confirm: |
4551 if ui.promptchoice(_(b'mark all unresolved files as resolved (yn)?' | 4546 if all: |
4552 b'$$ &Yes $$ &No')): | 4547 if ui.promptchoice(_(b're-merge all unresolved files (yn)?' |
4553 raise error.Abort(_('user quit')) | 4548 b'$$ &Yes $$ &No')): |
4554 if unmark and confirm and not pats: | 4549 raise error.Abort(_('user quit')) |
4555 if ui.promptchoice(_(b'mark all resolved files as unresolved (yn)?' | 4550 if mark and not pats: |
4556 b'$$ &Yes $$ &No')): | 4551 if ui.promptchoice(_(b'mark all unresolved files as resolved (yn)?' |
4557 raise error.Abort(_('user quit')) | 4552 b'$$ &Yes $$ &No')): |
4553 raise error.Abort(_('user quit')) | |
4554 if unmark and not pats: | |
4555 if ui.promptchoice(_(b'mark all resolved files as unresolved (yn)?' | |
4556 b'$$ &Yes $$ &No')): | |
4557 raise error.Abort(_('user quit')) | |
4558 | 4558 |
4559 if show: | 4559 if show: |
4560 ui.pager('resolve') | 4560 ui.pager('resolve') |
4561 fm = ui.formatter('resolve', opts) | 4561 fm = ui.formatter('resolve', opts) |
4562 ms = mergemod.mergestate.read(repo) | 4562 ms = mergemod.mergestate.read(repo) |