##// 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 1021 inmemory = ui.configbool(b'rebase', b'experimental.inmemory')
1022 1022 dryrun = opts.get(b'dry_run')
1023 1023 confirm = opts.get(b'confirm')
1024 selactions = [k for k in [b'abort', b'stop', b'continue'] if opts.get(k)]
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
1024 action = cmdutil.check_at_most_one_arg(opts, b'abort', b'stop', b'continue')
1030 1025 if dryrun and action:
1031 1026 raise error.Abort(_(b'cannot specify both --dry-run and --%s') % action)
1032 1027 if confirm and action:
@@ -261,7 +261,10 b' debugrevlogopts = ['
261 261
262 262
263 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 268 previous = None
266 269 for x in args:
267 270 if opts.get(x):
@@ -270,6 +273,7 b' def check_at_most_one_arg(opts, *args):'
270 273 _(b'cannot specify both --%s and --%s') % (previous, x)
271 274 )
272 275 previous = x
276 return previous
273 277
274 278
275 279 def check_incompatible_arguments(opts, first, *others):
@@ -2062,7 +2062,7 b' Test --stop raise errors with conflictin'
2062 2062 (use 'hg rebase --continue' or 'hg rebase --abort')
2063 2063 [255]
2064 2064 $ hg rebase --stop --continue
2065 abort: cannot use --stop with --continue
2065 abort: cannot specify both --stop and --continue
2066 2066 [255]
2067 2067
2068 2068 Test --stop moves bookmarks of original revisions to new rebased nodes:
@@ -61,7 +61,7 b' These fail:'
61 61 [1]
62 62
63 63 $ hg rebase --continue --abort
64 abort: cannot use --abort with --continue
64 abort: cannot specify both --abort and --continue
65 65 [255]
66 66
67 67 $ hg rebase --continue --collapse
General Comments 0
You need to be logged in to leave comments. Login now