comparison hgext/rebase.py @ 39099:3f9a5d746cf6

rebase: consolidate check for --dry-run/--confirm on abort/stop/continue
author Yuya Nishihara <yuya@tcha.org>
date Wed, 15 Aug 2018 10:41:26 +0900
parents a42506059522
children e9e742bd0501
comparison
equal deleted inserted replaced
39098:a42506059522 39099:3f9a5d746cf6
809 stop = opts.get('stop') 809 stop = opts.get('stop')
810 selactions = [k for k in ['abort', 'stop', 'continue'] if opts.get(k)] 810 selactions = [k for k in ['abort', 'stop', 'continue'] if opts.get(k)]
811 if len(selactions) > 1: 811 if len(selactions) > 1:
812 raise error.Abort(_('cannot use --%s with --%s') 812 raise error.Abort(_('cannot use --%s with --%s')
813 % tuple(selactions[:2])) 813 % tuple(selactions[:2]))
814 if stop: 814 action = selactions[0] if selactions else None
815 if opts.get('dry_run') or opts.get('confirm'): 815 if dryrun and action:
816 raise error.Abort(_('cannot use --stop with --dry-run ' 816 raise error.Abort(_('cannot specify both --dry-run and --%s') % action)
817 'or --confirm')) 817 if confirm and action:
818 if dryrun: 818 raise error.Abort(_('cannot specify both --confirm and --%s') % action)
819 if opts.get('abort'): 819 if dryrun and confirm:
820 raise error.Abort(_('cannot specify both --dry-run and --abort')) 820 raise error.Abort(_('cannot specify both --confirm and --dry-run'))
821 if opts.get('continue'):
822 raise error.Abort(_('cannot specify both --dry-run and --continue'))
823 if confirm:
824 if opts.get('dry_run'):
825 raise error.Abort(_('cannot specify both --confirm and --dry-run'))
826 if opts.get('abort'):
827 raise error.Abort(_('cannot specify both --confirm and --abort'))
828 if opts.get('continue'):
829 raise error.Abort(_('cannot specify both --confirm and --continue'))
830 821
831 if (opts.get('continue') or opts.get('abort') or 822 if (opts.get('continue') or opts.get('abort') or
832 repo.currenttransaction() is not None): 823 repo.currenttransaction() is not None):
833 # in-memory rebase is not compatible with resuming rebases. 824 # in-memory rebase is not compatible with resuming rebases.
834 # (Or if it is run within a transaction, since the restart logic can 825 # (Or if it is run within a transaction, since the restart logic can