diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -4041,6 +4041,10 @@ Returns 0 on success, 1 on partial success (see --partial). """ + cmdutil.check_incompatible_arguments( + opts, 'no_commit', ['bypass', 'secret'] + ) + cmdutil.check_incompatible_arguments(opts, 'exact', ['edit', 'prefix']) opts = pycompat.byteskwargs(opts) if not patch1: raise error.Abort(_(b'need at least one patch to import')) @@ -4053,10 +4057,6 @@ exact = opts.get(b'exact') update = not opts.get(b'bypass') - if not update and opts.get(b'no_commit'): - raise error.Abort(_(b'cannot use --no-commit with --bypass')) - if opts.get(b'secret') and opts.get(b'no_commit'): - raise error.Abort(_(b'cannot use --no-commit with --secret')) try: sim = float(opts.get(b'similarity') or 0) except ValueError: @@ -4065,11 +4065,6 @@ raise error.Abort(_(b'similarity must be between 0 and 100')) if sim and not update: raise error.Abort(_(b'cannot use --similarity with --bypass')) - if exact: - if opts.get(b'edit'): - raise error.Abort(_(b'cannot use --exact with --edit')) - if opts.get(b'prefix'): - raise error.Abort(_(b'cannot use --exact with --prefix')) base = opts[b"base"] msgs = [] diff --git a/tests/test-import-bypass.t b/tests/test-import-bypass.t --- a/tests/test-import-bypass.t +++ b/tests/test-import-bypass.t @@ -26,7 +26,7 @@ and '--edit') $ hg import --bypass --exact --edit ../test.diff - abort: cannot use --exact with --edit + abort: cannot specify both --exact and --edit [255] $ hg import --bypass --exact ../test.diff applying ../test.diff @@ -188,13 +188,13 @@ Test unsupported combinations $ hg import --bypass --no-commit ../test.diff - abort: cannot use --no-commit with --bypass + abort: cannot specify both --no-commit and --bypass [255] $ hg import --bypass --similarity 50 ../test.diff abort: cannot use --similarity with --bypass [255] $ hg import --exact --prefix dir/ ../test.diff - abort: cannot use --exact with --prefix + abort: cannot specify both --exact and --prefix [255] Test commit editor diff --git a/tests/test-import.t b/tests/test-import.t --- a/tests/test-import.t +++ b/tests/test-import.t @@ -444,7 +444,7 @@ $ hg clone -r0 a b -q $ hg --cwd b import --no-commit --secret ../exported-tip.patch - abort: cannot use --no-commit with --secret + abort: cannot specify both --no-commit and --secret [255] $ hg --cwd b import --secret ../exported-tip.patch applying ../exported-tip.patch