comparison hgext/rebase.py @ 39094:2cf0b8b830ba

rebase: raise error for options conflicting with --stop Make sure --stop feature raise error for conflicting options --continue, --abort, --confirm, --dry-run. Tests are added to reflect the same. Differential Revision: https://phab.mercurial-scm.org/D3969
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Sun, 22 Jul 2018 22:04:49 +0530
parents cc37009e95ca
children 571361e47137
comparison
equal deleted inserted replaced
39093:cc37009e95ca 39094:2cf0b8b830ba
803 """ 803 """
804 opts = pycompat.byteskwargs(opts) 804 opts = pycompat.byteskwargs(opts)
805 inmemory = ui.configbool('rebase', 'experimental.inmemory') 805 inmemory = ui.configbool('rebase', 'experimental.inmemory')
806 dryrun = opts.get('dry_run') 806 dryrun = opts.get('dry_run')
807 stop = opts.get('stop') 807 stop = opts.get('stop')
808 if stop:
809 if opts.get('dry_run') or opts.get('confirm'):
810 raise error.Abort(_('cannot use --stop with --dry-run '
811 'or --confirm'))
812 if opts.get('abort') or opts.get('continue'):
813 raise error.Abort(_('cannot use --stop with --abort or --continue'))
808 if dryrun: 814 if dryrun:
809 if opts.get('abort'): 815 if opts.get('abort'):
810 raise error.Abort(_('cannot specify both --dry-run and --abort')) 816 raise error.Abort(_('cannot specify both --dry-run and --abort'))
811 if opts.get('continue'): 817 if opts.get('continue'):
812 raise error.Abort(_('cannot specify both --dry-run and --continue')) 818 raise error.Abort(_('cannot specify both --dry-run and --continue'))
839 return _dryrunrebase(ui, repo, opts) 845 return _dryrunrebase(ui, repo, opts)
840 elif stop: 846 elif stop:
841 rbsrt = rebaseruntime(repo, ui) 847 rbsrt = rebaseruntime(repo, ui)
842 rbsrt.restorestatus() 848 rbsrt.restorestatus()
843 849
844 #todo: raise error for conflicting options
845 if rbsrt.collapsef: 850 if rbsrt.collapsef:
846 raise error.Abort(_("cannot stop in --collapse session")) 851 raise error.Abort(_("cannot stop in --collapse session"))
847 allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt) 852 allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
848 if not (rbsrt.keepf or allowunstable): 853 if not (rbsrt.keepf or allowunstable):
849 raise error.Abort(_("cannot remove original changesets with" 854 raise error.Abort(_("cannot remove original changesets with"