##// END OF EJS Templates
cmdutil: change check_incompatible_arguments() *arg to single iterable...
Martin von Zweigbergk -
r44655:d4c15012 default
parent child Browse files
Show More
@@ -1011,10 +1011,10 b' def rebase(ui, repo, **opts):'
1011 action = cmdutil.check_at_most_one_arg(opts, b'abort', b'stop', b'continue')
1011 action = cmdutil.check_at_most_one_arg(opts, b'abort', b'stop', b'continue')
1012 if action:
1012 if action:
1013 cmdutil.check_incompatible_arguments(
1013 cmdutil.check_incompatible_arguments(
1014 opts, action, b'confirm', b'dry_run'
1014 opts, action, [b'confirm', b'dry_run']
1015 )
1015 )
1016 cmdutil.check_incompatible_arguments(
1016 cmdutil.check_incompatible_arguments(
1017 opts, action, b'rev', b'source', b'base', b'dest'
1017 opts, action, [b'rev', b'source', b'base', b'dest']
1018 )
1018 )
1019 cmdutil.check_at_most_one_arg(opts, b'confirm', b'dry_run')
1019 cmdutil.check_at_most_one_arg(opts, b'confirm', b'dry_run')
1020 cmdutil.check_at_most_one_arg(opts, b'rev', b'source', b'base')
1020 cmdutil.check_at_most_one_arg(opts, b'rev', b'source', b'base')
@@ -1028,7 +1028,7 b' def rebase(ui, repo, **opts):'
1028 if opts.get(b'auto_orphans'):
1028 if opts.get(b'auto_orphans'):
1029 disallowed_opts = set(opts) - {b'auto_orphans'}
1029 disallowed_opts = set(opts) - {b'auto_orphans'}
1030 cmdutil.check_incompatible_arguments(
1030 cmdutil.check_incompatible_arguments(
1031 opts, b'auto_orphans', *disallowed_opts
1031 opts, b'auto_orphans', disallowed_opts
1032 )
1032 )
1033
1033
1034 userrevs = list(repo.revs(opts.get(b'auto_orphans')))
1034 userrevs = list(repo.revs(opts.get(b'auto_orphans')))
@@ -654,7 +654,7 b' def releasenotes(ui, repo, file_=None, *'
654 opts = pycompat.byteskwargs(opts)
654 opts = pycompat.byteskwargs(opts)
655 sections = releasenotessections(ui, repo)
655 sections = releasenotessections(ui, repo)
656
656
657 cmdutil.check_incompatible_arguments(opts, b'list', b'rev', b'check')
657 cmdutil.check_incompatible_arguments(opts, b'list', [b'rev', b'check'])
658
658
659 if opts.get(b'list'):
659 if opts.get(b'list'):
660 return _getadmonitionlist(ui, sections)
660 return _getadmonitionlist(ui, sections)
@@ -761,12 +761,12 b' def _dotransplant(ui, repo, *revs, **opt'
761 def checkopts(opts, revs):
761 def checkopts(opts, revs):
762 if opts.get(b'continue'):
762 if opts.get(b'continue'):
763 cmdutil.check_incompatible_arguments(
763 cmdutil.check_incompatible_arguments(
764 opts, b'continue', b'branch', b'all', b'merge'
764 opts, b'continue', [b'branch', b'all', b'merge']
765 )
765 )
766 return
766 return
767 if opts.get(b'stop'):
767 if opts.get(b'stop'):
768 cmdutil.check_incompatible_arguments(
768 cmdutil.check_incompatible_arguments(
769 opts, b'stop', b'branch', b'all', b'merge'
769 opts, b'stop', [b'branch', b'all', b'merge']
770 )
770 )
771 return
771 return
772 if not (
772 if not (
@@ -281,11 +281,11 b' def check_at_most_one_arg(opts, *args):'
281 return previous
281 return previous
282
282
283
283
284 def check_incompatible_arguments(opts, first, *others):
284 def check_incompatible_arguments(opts, first, others):
285 """abort if the first argument is given along with any of the others
285 """abort if the first argument is given along with any of the others
286
286
287 Unlike check_at_most_one_arg(), `others` are not mutually exclusive
287 Unlike check_at_most_one_arg(), `others` are not mutually exclusive
288 among themselves.
288 among themselves, and they're passed as a single collection.
289 """
289 """
290 for other in others:
290 for other in others:
291 check_at_most_one_arg(opts, first, other)
291 check_at_most_one_arg(opts, first, other)
@@ -1228,7 +1228,7 b' def bookmark(ui, repo, *names, **opts):'
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 cmdutil.check_incompatible_arguments(opts, action, b'rev')
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:
@@ -1236,7 +1236,9 b' def bookmark(ui, repo, *names, **opts):'
1236 else:
1236 else:
1237 action = b'list'
1237 action = b'list'
1238
1238
1239 cmdutil.check_incompatible_arguments(opts, b'inactive', b'delete', b'list')
1239 cmdutil.check_incompatible_arguments(
1240 opts, b'inactive', [b'delete', b'list']
1241 )
1240 if not names and action in {b'add', b'delete'}:
1242 if not names and action in {b'add', b'delete'}:
1241 raise error.Abort(_(b"bookmark name required"))
1243 raise error.Abort(_(b"bookmark name required"))
1242
1244
@@ -4847,7 +4849,7 b' def merge(ui, repo, node=None, **opts):'
4847 abort = opts.get(b'abort')
4849 abort = opts.get(b'abort')
4848 if abort and repo.dirstate.p2() == nullid:
4850 if abort and repo.dirstate.p2() == nullid:
4849 cmdutil.wrongtooltocontinue(repo, _(b'merge'))
4851 cmdutil.wrongtooltocontinue(repo, _(b'merge'))
4850 cmdutil.check_incompatible_arguments(opts, b'abort', b'rev', b'preview')
4852 cmdutil.check_incompatible_arguments(opts, b'abort', [b'rev', b'preview'])
4851 if abort:
4853 if abort:
4852 state = cmdutil.getunfinishedstate(repo)
4854 state = cmdutil.getunfinishedstate(repo)
4853 if state and state._opname != b'merge':
4855 if state and state._opname != b'merge':
@@ -17,3 +17,6 b''
17
17
18 * `hg.merge()` has lost its `abort` argument. Please call
18 * `hg.merge()` has lost its `abort` argument. Please call
19 `hg.abortmerge()` directly instead.
19 `hg.abortmerge()` directly instead.
20
21 * The `*others` argument of `cmdutil.check_incompatible_arguments()`
22 changed from being varargs argument to being a single collection.
General Comments 0
You need to be logged in to leave comments. Login now