# HG changeset patch # User Martin von Zweigbergk # Date 1593116945 25200 # Node ID c63a297fb964b8b5d4c48dc4a75b04f25d72884b # Parent 7d494425167cdf9d3dd34cd7680186ba0b363819 graft: leverage cmdutil.check_incompatible_arguments() for --no-commit Differential Revision: https://phab.mercurial-scm.org/D8668 diff -r 7d494425167c -r c63a297fb964 mercurial/commands.py --- a/mercurial/commands.py Thu Jun 25 13:27:37 2020 -0700 +++ b/mercurial/commands.py Thu Jun 25 13:29:05 2020 -0700 @@ -2986,22 +2986,11 @@ cont = False if opts.get(b'no_commit'): - if opts.get(b'edit'): - raise error.Abort( - _(b"cannot specify --no-commit and --edit together") - ) - if opts.get(b'currentuser'): - raise error.Abort( - _(b"cannot specify --no-commit and --currentuser together") - ) - if opts.get(b'currentdate'): - raise error.Abort( - _(b"cannot specify --no-commit and --currentdate together") - ) - if opts.get(b'log'): - raise error.Abort( - _(b"cannot specify --no-commit and --log together") - ) + cmdutil.check_incompatible_arguments( + opts, + b'no_commit', + [b'edit', b'currentuser', b'currentdate', b'log'], + ) graftstate = statemod.cmdstate(repo, b'graftstate') diff -r 7d494425167c -r c63a297fb964 tests/test-graft-interrupted.t --- a/tests/test-graft-interrupted.t Thu Jun 25 13:27:37 2020 -0700 +++ b/tests/test-graft-interrupted.t Thu Jun 25 13:29:05 2020 -0700 @@ -553,15 +553,15 @@ Check reporting when --no-commit used with non-applicable options: $ hg graft 1 --no-commit -e - abort: cannot specify --no-commit and --edit together + abort: cannot specify both --no-commit and --edit [255] $ hg graft 1 --no-commit --log - abort: cannot specify --no-commit and --log together + abort: cannot specify both --no-commit and --log [255] $ hg graft 1 --no-commit -D - abort: cannot specify --no-commit and --currentdate together + abort: cannot specify both --no-commit and --currentdate [255] Test --no-commit is working: