# HG changeset patch # User Sushil khanchi # Date 2018-07-22 16:34:49 # Node ID 2cf0b8b830ba266fee2f69336f4268528f0619a6 # Parent cc37009e95ca32ae1b3ad7ce8b7648f7683b1361 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 diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -805,6 +805,12 @@ def rebase(ui, repo, **opts): inmemory = ui.configbool('rebase', 'experimental.inmemory') dryrun = opts.get('dry_run') stop = opts.get('stop') + 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')) @@ -841,7 +847,6 @@ def rebase(ui, repo, **opts): rbsrt = rebaseruntime(repo, ui) rbsrt.restorestatus() - #todo: raise error for conflicting options if rbsrt.collapsef: raise error.Abort(_("cannot stop in --collapse session")) allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt) diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t --- a/tests/test-rebase-obsolete.t +++ b/tests/test-rebase-obsolete.t @@ -2003,3 +2003,22 @@ Test --stop aborts when --collapse was p o 0:cb9a9f314b8b test a +Test --stop raise errors with conflicting options: +================================================= + $ hg rebase -s 3 -d 5 + rebasing 3:055a42cdd887 "d" + merging d + warning: conflicts while merging d! (edit, then use 'hg resolve --mark') + unresolved conflicts (see hg resolve, then hg rebase --continue) + [1] + $ hg rebase --stop --dry-run + abort: cannot use --stop with --dry-run or --confirm + [255] + + $ hg rebase -s 3 -d 5 + abort: rebase in progress + (use 'hg rebase --continue' or 'hg rebase --abort') + [255] + $ hg rebase --stop --continue + abort: cannot use --stop with --abort or --continue + [255]