##// END OF EJS Templates
rebase: use cmdutil.check_at_most_one_arg() for action...
Martin von Zweigbergk -
r44351:fff21278 default
parent child Browse files
Show More
@@ -1021,12 +1021,7 b' def rebase(ui, repo, **opts):'
1021 inmemory = ui.configbool(b'rebase', b'experimental.inmemory')
1021 inmemory = ui.configbool(b'rebase', b'experimental.inmemory')
1022 dryrun = opts.get(b'dry_run')
1022 dryrun = opts.get(b'dry_run')
1023 confirm = opts.get(b'confirm')
1023 confirm = opts.get(b'confirm')
1024 selactions = [k for k in [b'abort', b'stop', b'continue'] if opts.get(k)]
1024 action = cmdutil.check_at_most_one_arg(opts, b'abort', b'stop', b'continue')
1025 if len(selactions) > 1:
1026 raise error.Abort(
1027 _(b'cannot use --%s with --%s') % tuple(selactions[:2])
1028 )
1029 action = selactions[0] if selactions else None
1030 if dryrun and action:
1025 if dryrun and action:
1031 raise error.Abort(_(b'cannot specify both --dry-run and --%s') % action)
1026 raise error.Abort(_(b'cannot specify both --dry-run and --%s') % action)
1032 if confirm and action:
1027 if confirm and action:
@@ -261,7 +261,10 b' debugrevlogopts = ['
261
261
262
262
263 def check_at_most_one_arg(opts, *args):
263 def check_at_most_one_arg(opts, *args):
264 """abort if more than one of the arguments are in opts"""
264 """abort if more than one of the arguments are in opts
265
266 Returns the unique argument or None if none of them were specified.
267 """
265 previous = None
268 previous = None
266 for x in args:
269 for x in args:
267 if opts.get(x):
270 if opts.get(x):
@@ -270,6 +273,7 b' def check_at_most_one_arg(opts, *args):'
270 _(b'cannot specify both --%s and --%s') % (previous, x)
273 _(b'cannot specify both --%s and --%s') % (previous, x)
271 )
274 )
272 previous = x
275 previous = x
276 return previous
273
277
274
278
275 def check_incompatible_arguments(opts, first, *others):
279 def check_incompatible_arguments(opts, first, *others):
@@ -2062,7 +2062,7 b' Test --stop raise errors with conflictin'
2062 (use 'hg rebase --continue' or 'hg rebase --abort')
2062 (use 'hg rebase --continue' or 'hg rebase --abort')
2063 [255]
2063 [255]
2064 $ hg rebase --stop --continue
2064 $ hg rebase --stop --continue
2065 abort: cannot use --stop with --continue
2065 abort: cannot specify both --stop and --continue
2066 [255]
2066 [255]
2067
2067
2068 Test --stop moves bookmarks of original revisions to new rebased nodes:
2068 Test --stop moves bookmarks of original revisions to new rebased nodes:
@@ -61,7 +61,7 b' These fail:'
61 [1]
61 [1]
62
62
63 $ hg rebase --continue --abort
63 $ hg rebase --continue --abort
64 abort: cannot use --abort with --continue
64 abort: cannot specify both --abort and --continue
65 [255]
65 [255]
66
66
67 $ hg rebase --continue --collapse
67 $ hg rebase --continue --collapse
General Comments 0
You need to be logged in to leave comments. Login now