Patchwork D7635: amend: use cmdutil.check_at_most_one_arg()

login
register
mail settings
Submitter phabricator
Date Dec. 17, 2019, 7:58 a.m.
Message ID <9baaad138fdaca9894e942cc6f8be3e5@localhost.localdomain>
Download mbox | patch
Permalink /patch/43898/
State Not Applicable
Headers show

Comments

phabricator - Dec. 17, 2019, 7:58 a.m.
Closed by commit rHG774cee0e95c6: amend: use cmdutil.check_at_most_one_arg() (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7635?vs=18761&id=18789

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7635/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7635

AFFECTED FILES
  mercurial/cmdutil.py
  tests/test-amend.t

CHANGE DETAILS




To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

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 @@ 
 
   $ 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 !)
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1056,13 +1056,12 @@ 
 
 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):