# HG changeset patch # User Martin von Zweigbergk # Date 1576222277 28800 # Node ID 3b50de911200a2dca249f67e0b5036523ccd2f44 # Parent fff21278554bc693c66e9e8658c75038b0b43b44 bookmarks: use cmdutil.check_at_most_one_arg() for action Differential Revision: https://phab.mercurial-scm.org/D7647 diff -r fff21278554b -r 3b50de911200 mercurial/commands.py --- a/mercurial/commands.py Thu Dec 12 15:55:33 2019 -0800 +++ b/mercurial/commands.py Thu Dec 12 23:31:17 2019 -0800 @@ -1226,13 +1226,9 @@ rev = opts.get(b'rev') inactive = opts.get(b'inactive') # meaning add/rename to inactive bookmark - selactions = [k for k in [b'delete', b'rename', b'list'] if opts.get(k)] - if len(selactions) > 1: - raise error.Abort( - _(b'--%s and --%s are incompatible') % tuple(selactions[:2]) - ) - if selactions: - action = selactions[0] + action = cmdutil.check_at_most_one_arg(opts, b'delete', b'rename', b'list') + if action: + pass elif names or rev: action = b'add' elif inactive: diff -r fff21278554b -r 3b50de911200 tests/test-bookmarks.t --- a/tests/test-bookmarks.t Thu Dec 12 15:55:33 2019 -0800 +++ b/tests/test-bookmarks.t Thu Dec 12 23:31:17 2019 -0800 @@ -475,7 +475,7 @@ $ cd repo $ hg bookmark -m Y -d Z - abort: --delete and --rename are incompatible + abort: cannot specify both --delete and --rename [255] $ hg bookmark -r 1 -d Z