comparison mercurial/commands.py @ 45009:7d494425167c

graft: leverage cmdutil.check_at_most_one_arg() for --abort/--stop/--continue Differential Revision: https://phab.mercurial-scm.org/D8667
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 25 Jun 2020 13:27:37 -0700
parents e1ea913da2ed
children c63a297fb964
comparison
equal deleted inserted replaced
45008:e1ea913da2ed 45009:7d494425167c
2980 2980
2981 editor = cmdutil.getcommiteditor( 2981 editor = cmdutil.getcommiteditor(
2982 editform=b'graft', **pycompat.strkwargs(opts) 2982 editform=b'graft', **pycompat.strkwargs(opts)
2983 ) 2983 )
2984 2984
2985 cmdutil.check_at_most_one_arg(opts, b'abort', b'stop', b'continue')
2986
2985 cont = False 2987 cont = False
2986 if opts.get(b'no_commit'): 2988 if opts.get(b'no_commit'):
2987 if opts.get(b'edit'): 2989 if opts.get(b'edit'):
2988 raise error.Abort( 2990 raise error.Abort(
2989 _(b"cannot specify --no-commit and --edit together") 2991 _(b"cannot specify --no-commit and --edit together")
3002 ) 3004 )
3003 3005
3004 graftstate = statemod.cmdstate(repo, b'graftstate') 3006 graftstate = statemod.cmdstate(repo, b'graftstate')
3005 3007
3006 if opts.get(b'stop'): 3008 if opts.get(b'stop'):
3007 if opts.get(b'continue'):
3008 raise error.Abort(
3009 _(b"cannot use '--continue' and '--stop' together")
3010 )
3011 if opts.get(b'abort'):
3012 raise error.Abort(_(b"cannot use '--abort' and '--stop' together"))
3013
3014 if any( 3009 if any(
3015 ( 3010 (
3016 opts.get(b'edit'), 3011 opts.get(b'edit'),
3017 opts.get(b'log'), 3012 opts.get(b'log'),
3018 opts.get(b'user'), 3013 opts.get(b'user'),
3023 ) 3018 )
3024 ): 3019 ):
3025 raise error.Abort(_(b"cannot specify any other flag with '--stop'")) 3020 raise error.Abort(_(b"cannot specify any other flag with '--stop'"))
3026 return _stopgraft(ui, repo, graftstate) 3021 return _stopgraft(ui, repo, graftstate)
3027 elif opts.get(b'abort'): 3022 elif opts.get(b'abort'):
3028 if opts.get(b'continue'):
3029 raise error.Abort(
3030 _(b"cannot use '--continue' and '--abort' together")
3031 )
3032 if any( 3023 if any(
3033 ( 3024 (
3034 opts.get(b'edit'), 3025 opts.get(b'edit'),
3035 opts.get(b'log'), 3026 opts.get(b'log'),
3036 opts.get(b'user'), 3027 opts.get(b'user'),