diff --git a/mercurial/cmd_impls/graft.py b/mercurial/cmd_impls/graft.py index 0b52283d50bb14942e8a47414dc24845b63e4dae_bWVyY3VyaWFsL2NtZF9pbXBscy9ncmFmdC5weQ==..8faabe8abf66c752a30a86d59b115f9a91d33a8b_bWVyY3VyaWFsL2NtZF9pbXBscy9ncmFmdC5weQ== 100644 --- a/mercurial/cmd_impls/graft.py +++ b/mercurial/cmd_impls/graft.py @@ -44,5 +44,7 @@ # list of new nodes created by ongoing graft statedata[b'newnodes'] = [] - cmdutil.resolve_commit_options(ui, opts) + # argument incompatible with followup from an interrupted operation + commit_args = ['edit', 'log', 'user', 'date', 'currentdate', 'currentuser'] + nofollow_args = commit_args + ['rev'] @@ -48,2 +50,7 @@ + arg_compatibilities = [ + ('no_commit', commit_args), + ('stop', nofollow_args), + ('abort', nofollow_args), + ] cmdutil.check_at_most_one_arg(opts, 'abort', 'stop', 'continue') @@ -49,3 +56,7 @@ cmdutil.check_at_most_one_arg(opts, 'abort', 'stop', 'continue') + for arg, incompatible in arg_compatibilities: + cmdutil.check_incompatible_arguments(opts, arg, incompatible) + + cmdutil.resolve_commit_options(ui, opts) cont = False @@ -50,12 +61,6 @@ cont = False - if opts.get('no_commit'): - cmdutil.check_incompatible_arguments( - opts, - 'no_commit', - ['edit', 'currentuser', 'currentdate', 'log'], - ) graftstate = statemod.cmdstate(repo, b'graftstate') if opts.get('stop'): @@ -58,19 +63,6 @@ graftstate = statemod.cmdstate(repo, b'graftstate') if opts.get('stop'): - cmdutil.check_incompatible_arguments( - opts, - 'stop', - [ - 'edit', - 'log', - 'user', - 'date', - 'currentdate', - 'currentuser', - 'rev', - ], - ) return "STOP", graftstate, None elif opts.get('abort'): @@ -75,18 +67,5 @@ return "STOP", graftstate, None elif opts.get('abort'): - cmdutil.check_incompatible_arguments( - opts, - 'abort', - [ - 'edit', - 'log', - 'user', - 'date', - 'currentdate', - 'currentuser', - 'rev', - ], - ) return "ABORT", graftstate, None elif opts.get('continue'): cont = True diff --git a/tests/test-graft-interrupted.t b/tests/test-graft-interrupted.t index 0b52283d50bb14942e8a47414dc24845b63e4dae_dGVzdHMvdGVzdC1ncmFmdC1pbnRlcnJ1cHRlZC50..8faabe8abf66c752a30a86d59b115f9a91d33a8b_dGVzdHMvdGVzdC1ncmFmdC1pbnRlcnJ1cHRlZC50 100644 --- a/tests/test-graft-interrupted.t +++ b/tests/test-graft-interrupted.t @@ -253,7 +253,7 @@ [10] $ hg graft --stop -U - abort: cannot specify both --stop and --user + abort: cannot specify both --stop and --currentuser [10] $ hg graft --stop --rev 4 abort: cannot specify both --stop and --rev @@ -363,7 +363,7 @@ [10] $ hg graft --abort --currentuser - abort: cannot specify both --abort and --user + abort: cannot specify both --abort and --currentuser [10] $ hg graft --abort --edit