Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 43901:5cde16489b42
bookmarks: use cmdutil.check_incompatible_arguments() for action+rev
Differential Revision: https://phab.mercurial-scm.org/D7648
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 12 Dec 2019 23:32:47 -0800 |
parents | 3b50de911200 |
children | e623ad1b4800 |
comparison
equal
deleted
inserted
replaced
43900:3b50de911200 | 43901:5cde16489b42 |
---|---|
1226 rev = opts.get(b'rev') | 1226 rev = opts.get(b'rev') |
1227 inactive = opts.get(b'inactive') # meaning add/rename to inactive bookmark | 1227 inactive = opts.get(b'inactive') # meaning add/rename to inactive bookmark |
1228 | 1228 |
1229 action = cmdutil.check_at_most_one_arg(opts, b'delete', b'rename', b'list') | 1229 action = cmdutil.check_at_most_one_arg(opts, b'delete', b'rename', b'list') |
1230 if action: | 1230 if action: |
1231 pass | 1231 cmdutil.check_incompatible_arguments(opts, action, b'rev') |
1232 elif names or rev: | 1232 elif names or rev: |
1233 action = b'add' | 1233 action = b'add' |
1234 elif inactive: | 1234 elif inactive: |
1235 action = b'inactive' # meaning deactivate | 1235 action = b'inactive' # meaning deactivate |
1236 else: | 1236 else: |
1237 action = b'list' | 1237 action = b'list' |
1238 | 1238 |
1239 if rev and action in {b'delete', b'rename', b'list'}: | |
1240 raise error.Abort(_(b"--rev is incompatible with --%s") % action) | |
1241 if inactive and action in {b'delete', b'list'}: | 1239 if inactive and action in {b'delete', b'list'}: |
1242 raise error.Abort(_(b"--inactive is incompatible with --%s") % action) | 1240 raise error.Abort(_(b"--inactive is incompatible with --%s") % action) |
1243 if not names and action in {b'add', b'delete'}: | 1241 if not names and action in {b'add', b'delete'}: |
1244 raise error.Abort(_(b"bookmark name required")) | 1242 raise error.Abort(_(b"bookmark name required")) |
1245 | 1243 |