rebase: use cmdutil.check_at_most_one_arg() for action+revision
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 12 Dec 2019 23:20:48 -0800
changeset 43931 8c87cc169946
parent 43930 412f199b4092
child 43932 9fb9f3a5cad7
rebase: use cmdutil.check_at_most_one_arg() for action+revision Differential Revision: https://phab.mercurial-scm.org/D7645
hgext/rebase.py
tests/test-rebase-parameters.t
--- a/hgext/rebase.py	Thu Dec 12 23:03:52 2019 -0800
+++ b/hgext/rebase.py	Thu Dec 12 23:20:48 2019 -0800
@@ -1024,6 +1024,9 @@
         cmdutil.check_incompatible_arguments(
             opts, action, b'confirm', b'dry_run'
         )
+        cmdutil.check_incompatible_arguments(
+            opts, action, b'rev', b'source', b'base', b'dest'
+        )
     cmdutil.check_at_most_one_arg(opts, b'confirm', b'dry_run')
     cmdutil.check_at_most_one_arg(opts, b'rev', b'source', b'base')
 
@@ -1192,10 +1195,6 @@
                 raise error.Abort(
                     _(b'cannot use collapse with continue or abort')
                 )
-            if srcf or basef or destf:
-                raise error.Abort(
-                    _(b'abort and continue do not allow specifying revisions')
-                )
             if action == b'abort' and opts.get(b'tool', False):
                 ui.warn(_(b'tool option will be ignored\n'))
             if action == b'continue':
--- a/tests/test-rebase-parameters.t	Thu Dec 12 23:03:52 2019 -0800
+++ b/tests/test-rebase-parameters.t	Thu Dec 12 23:20:48 2019 -0800
@@ -69,7 +69,7 @@
   [255]
 
   $ hg rebase --continue --dest 4
-  abort: abort and continue do not allow specifying revisions
+  abort: cannot specify both --continue and --dest
   [255]
 
   $ hg rebase --base 5 --source 4