Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG49b51f41fb46: resolve: organize 'if confirm' conditionals
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/commands.py (26 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Sushil khanchi | Aug 6 2018, 12:33 AM |
""" | """ | ||||
opts = pycompat.byteskwargs(opts) | opts = pycompat.byteskwargs(opts) | ||||
confirm = ui.configbool('commands', 'resolve.confirm') | confirm = ui.configbool('commands', 'resolve.confirm') | ||||
flaglist = 'all mark unmark list no_status'.split() | flaglist = 'all mark unmark list no_status'.split() | ||||
all, mark, unmark, show, nostatus = \ | all, mark, unmark, show, nostatus = \ | ||||
[opts.get(o) for o in flaglist] | [opts.get(o) for o in flaglist] | ||||
if all and confirm: | |||||
if ui.promptchoice(_(b're-merge all unresolved files (yn)?' | |||||
b'$$ &Yes $$ &No')): | |||||
raise error.Abort(_('user quit')) | |||||
if (show and (mark or unmark)) or (mark and unmark): | if (show and (mark or unmark)) or (mark and unmark): | ||||
raise error.Abort(_("too many options specified")) | raise error.Abort(_("too many options specified")) | ||||
if pats and all: | if pats and all: | ||||
raise error.Abort(_("can't specify --all and patterns")) | raise error.Abort(_("can't specify --all and patterns")) | ||||
if not (all or pats or show or mark or unmark): | if not (all or pats or show or mark or unmark): | ||||
raise error.Abort(_('no files or directories specified'), | raise error.Abort(_('no files or directories specified'), | ||||
hint=('use --all to re-merge all unresolved files')) | hint=('use --all to re-merge all unresolved files')) | ||||
if mark and confirm and not pats: | if confirm: | ||||
if all: | |||||
if ui.promptchoice(_(b're-merge all unresolved files (yn)?' | |||||
b'$$ &Yes $$ &No')): | |||||
raise error.Abort(_('user quit')) | |||||
if mark and not pats: | |||||
if ui.promptchoice(_(b'mark all unresolved files as resolved (yn)?' | if ui.promptchoice(_(b'mark all unresolved files as resolved (yn)?' | ||||
b'$$ &Yes $$ &No')): | b'$$ &Yes $$ &No')): | ||||
raise error.Abort(_('user quit')) | raise error.Abort(_('user quit')) | ||||
if unmark and confirm and not pats: | if unmark and not pats: | ||||
if ui.promptchoice(_(b'mark all resolved files as unresolved (yn)?' | if ui.promptchoice(_(b'mark all resolved files as unresolved (yn)?' | ||||
b'$$ &Yes $$ &No')): | b'$$ &Yes $$ &No')): | ||||
raise error.Abort(_('user quit')) | raise error.Abort(_('user quit')) | ||||
if show: | if show: | ||||
ui.pager('resolve') | ui.pager('resolve') | ||||
fm = ui.formatter('resolve', opts) | fm = ui.formatter('resolve', opts) | ||||
ms = mergemod.mergestate.read(repo) | ms = mergemod.mergestate.read(repo) | ||||
wctx = repo[None] | wctx = repo[None] | ||||
m = scmutil.match(wctx, pats, opts) | m = scmutil.match(wctx, pats, opts) | ||||