# HG changeset patch # User Yuya Nishihara # Date 2018-08-15 01:41:26 # Node ID 3f9a5d746cf64f92b7b69a1317ad24a3755e246c # Parent a42506059522eca4f3071f2a5f525da7652cec3e rebase: consolidate check for --dry-run/--confirm on abort/stop/continue diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -811,22 +811,13 @@ def rebase(ui, repo, **opts): 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 dryrun: - if opts.get('abort'): - raise error.Abort(_('cannot specify both --dry-run and --abort')) - if opts.get('continue'): - raise error.Abort(_('cannot specify both --dry-run and --continue')) - if confirm: - if opts.get('dry_run'): - raise error.Abort(_('cannot specify both --confirm and --dry-run')) - if opts.get('abort'): - raise error.Abort(_('cannot specify both --confirm and --abort')) - if opts.get('continue'): - raise error.Abort(_('cannot specify both --confirm and --continue')) + action = selactions[0] if selactions else None + if dryrun and action: + raise error.Abort(_('cannot specify both --dry-run and --%s') % action) + if confirm and action: + raise error.Abort(_('cannot specify both --confirm and --%s') % action) + if dryrun and confirm: + raise error.Abort(_('cannot specify both --confirm and --dry-run')) if (opts.get('continue') or opts.get('abort') or repo.currenttransaction() is not None): 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 @@ -2012,7 +2012,7 @@ Test --stop raise errors with conflictin unresolved conflicts (see hg resolve, then hg rebase --continue) [1] $ hg rebase --stop --dry-run - abort: cannot use --stop with --dry-run or --confirm + abort: cannot specify both --dry-run and --stop [255] $ hg rebase -s 3 -d 5