##// END OF EJS Templates
releasenotes: extract helper for checking for incompatible arguments...
Martin von Zweigbergk -
r44350:023ad45e default
parent child Browse files
Show More
@@ -20,6 +20,7 b' import re'
20 from mercurial.i18n import _
20 from mercurial.i18n import _
21 from mercurial.pycompat import open
21 from mercurial.pycompat import open
22 from mercurial import (
22 from mercurial import (
23 cmdutil,
23 config,
24 config,
24 error,
25 error,
25 minirst,
26 minirst,
@@ -653,14 +654,9 b' def releasenotes(ui, repo, file_=None, *'
653 opts = pycompat.byteskwargs(opts)
654 opts = pycompat.byteskwargs(opts)
654 sections = releasenotessections(ui, repo)
655 sections = releasenotessections(ui, repo)
655
656
656 listflag = opts.get(b'list')
657 cmdutil.check_incompatible_arguments(opts, b'list', b'rev', b'check')
657
658
658 if listflag and opts.get(b'rev'):
659 if opts.get(b'list'):
659 raise error.Abort(_(b'cannot use both \'--list\' and \'--rev\''))
660 if listflag and opts.get(b'check'):
661 raise error.Abort(_(b'cannot use both \'--list\' and \'--check\''))
662
663 if listflag:
664 return _getadmonitionlist(ui, sections)
660 return _getadmonitionlist(ui, sections)
665
661
666 rev = opts.get(b'rev')
662 rev = opts.get(b'rev')
@@ -272,6 +272,16 b' def check_at_most_one_arg(opts, *args):'
272 previous = x
272 previous = x
273
273
274
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)
283
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
General Comments 0
You need to be logged in to leave comments. Login now