rebase: consolidate check for --abort/--stop/--continue conflicts
authorYuya Nishihara <yuya@tcha.org>
Wed, 15 Aug 2018 10:36:06 +0900
changeset 39098 a42506059522
parent 39097 c1a1fb389b4d
child 39099 3f9a5d746cf6
rebase: consolidate check for --abort/--stop/--continue conflicts
hgext/rebase.py
tests/test-rebase-obsolete.t
tests/test-rebase-parameters.t
--- a/hgext/rebase.py	Wed Aug 15 10:32:10 2018 +0900
+++ b/hgext/rebase.py	Wed Aug 15 10:36:06 2018 +0900
@@ -807,12 +807,14 @@
     dryrun = opts.get('dry_run')
     confirm = opts.get('confirm')
     stop = opts.get('stop')
+    selactions = [k for k in ['abort', 'stop', 'continue'] if opts.get(k)]
+    if len(selactions) > 1:
+        raise error.Abort(_('cannot use --%s with --%s')
+                          % tuple(selactions[:2]))
     if stop:
         if opts.get('dry_run') or opts.get('confirm'):
             raise error.Abort(_('cannot use --stop with --dry-run '
                                 'or --confirm'))
-        if opts.get('abort') or opts.get('continue'):
-            raise error.Abort(_('cannot use --stop with --abort or --continue'))
     if dryrun:
         if opts.get('abort'):
             raise error.Abort(_('cannot specify both --dry-run and --abort'))
@@ -950,8 +952,6 @@
                 _('message can only be specified with collapse'))
 
         if contf or abortf:
-            if contf and abortf:
-                raise error.Abort(_('cannot use both abort and continue'))
             if rbsrt.collapsef:
                 raise error.Abort(
                     _('cannot use collapse with continue or abort'))
--- a/tests/test-rebase-obsolete.t	Wed Aug 15 10:32:10 2018 +0900
+++ b/tests/test-rebase-obsolete.t	Wed Aug 15 10:36:06 2018 +0900
@@ -2020,7 +2020,7 @@
   (use 'hg rebase --continue' or 'hg rebase --abort')
   [255]
   $ hg rebase --stop --continue
-  abort: cannot use --stop with --abort or --continue
+  abort: cannot use --stop with --continue
   [255]
 
 Test --stop moves bookmarks of original revisions to new rebased nodes:
--- a/tests/test-rebase-parameters.t	Wed Aug 15 10:32:10 2018 +0900
+++ b/tests/test-rebase-parameters.t	Wed Aug 15 10:36:06 2018 +0900
@@ -61,7 +61,7 @@
   [1]
 
   $ hg rebase --continue --abort
-  abort: cannot use both abort and continue
+  abort: cannot use --abort with --continue
   [255]
 
   $ hg rebase --continue --collapse