# HG changeset patch # User Martin von Zweigbergk # Date 2019-12-12 23:10:44 # Node ID 774cee0e95c6c738897e6ed1603b9062beb92840 # Parent 2e672ccc22201a1bed5f11bd519b631a08919e4a amend: use cmdutil.check_at_most_one_arg() Differential Revision: https://phab.mercurial-scm.org/D7635 diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1056,13 +1056,12 @@ def bailifchanged(repo, merge=True, hint def logmessage(ui, opts): """ get the log message according to -m and -l option """ + + check_at_most_one_arg(opts, b'message', b'logfile') + message = opts.get(b'message') logfile = opts.get(b'logfile') - if message and logfile: - raise error.Abort( - _(b'options --message and --logfile are mutually exclusive') - ) if not message and logfile: try: if isstdiofilename(logfile): diff --git a/tests/test-amend.t b/tests/test-amend.t --- a/tests/test-amend.t +++ b/tests/test-amend.t @@ -129,7 +129,7 @@ Amend with editor $ echo FOO > $TESTTMP/msg $ hg amend -l $TESTTMP/msg -m BAR - abort: options --message and --logfile are mutually exclusive + abort: cannot specify both --message and --logfile [255] $ hg amend -l $TESTTMP/msg saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/974f07f28537-edb6470a-amend.hg (obsstore-off !)