From patchwork Fri Oct 16 06:03:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D9216: backout: leverage cmdutil.check_incompatible_arguments() From: phabricator X-Patchwork-Id: 47476 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Fri, 16 Oct 2020 06:03:30 +0000 martinvonz created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9216 AFFECTED FILES mercurial/commands.py tests/test-backout.t CHANGE DETAILS To: martinvonz, #hg-reviewers Cc: mercurial-patches, mercurial-devel diff --git a/tests/test-backout.t b/tests/test-backout.t --- a/tests/test-backout.t +++ b/tests/test-backout.t @@ -804,5 +804,5 @@ --no-commit can't be used with --merge $ hg backout --merge --no-commit 2 - abort: cannot use --merge with --no-commit + abort: cannot specify both --no-commit and --merge [255] diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -769,11 +769,8 @@ def _dobackout(ui, repo, node=None, rev=None, **opts): + cmdutil.check_incompatible_arguments(opts, 'no_commit', ['commit', 'merge']) opts = pycompat.byteskwargs(opts) - if opts.get(b'commit') and opts.get(b'no_commit'): - raise error.Abort(_(b"cannot use --commit with --no-commit")) - if opts.get(b'merge') and opts.get(b'no_commit'): - raise error.Abort(_(b"cannot use --merge with --no-commit")) if rev and node: raise error.Abort(_(b"please specify just one revision"))