diff hgext/rebase.py @ 39135:a42506059522

rebase: consolidate check for --abort/--stop/--continue conflicts
author Yuya Nishihara <yuya@tcha.org>
date Wed, 15 Aug 2018 10:36:06 +0900
parents c1a1fb389b4d
children 3f9a5d746cf6
line wrap: on
line diff
--- 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'))