comparison mercurial/cmdutil.py @ 43898:023ad45e2fd2

releasenotes: extract helper for checking for incompatible arguments This patch extracts a new check_incompatible_arguments() function similar to check_at_most_one_arg(). The difference is that the new function is for checking for arguments that are disallowed together with some other argument but not mutually exclusive among themselves. Differential Revision: https://phab.mercurial-scm.org/D7639
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 12 Dec 2019 22:30:59 -0800
parents 774cee0e95c6
children fff21278554b
comparison
equal deleted inserted replaced
43897:dda49ec2b54a 43898:023ad45e2fd2
268 if previous: 268 if previous:
269 raise error.Abort( 269 raise error.Abort(
270 _(b'cannot specify both --%s and --%s') % (previous, x) 270 _(b'cannot specify both --%s and --%s') % (previous, x)
271 ) 271 )
272 previous = x 272 previous = x
273
274
275 def check_incompatible_arguments(opts, first, *others):
276 """abort if the first argument is given along with any of the others
277
278 Unlike check_at_most_one_arg(), `others` are not mutually exclusive
279 among themselves.
280 """
281 for other in others:
282 check_at_most_one_arg(opts, first, other)
273 283
274 284
275 def resolvecommitoptions(ui, opts): 285 def resolvecommitoptions(ui, opts):
276 """modify commit options dict to handle related options 286 """modify commit options dict to handle related options
277 287