Patchwork D7661: rebase: use cmdutil.check_incompatible_arguments() for action+confirm/dryrun

login
register
mail settings
Submitter phabricator
Date Dec. 17, 2019, 6:10 p.m.
Message ID <0a51aaf21a5a5fba6f6b9a90e5277bc3@localhost.localdomain>
Download mbox | patch
Permalink /patch/43931/
State Not Applicable
Headers show

Comments

phabricator - Dec. 17, 2019, 6:10 p.m.
martinvonz updated this revision to Diff 18820.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7661?vs=18768&id=18820

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7661/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7661

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t
  tests/test-rebase-obsolete.t

CHANGE DETAILS




To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

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
@@ -2054,7 +2054,7 @@ 
   unresolved conflicts (see hg resolve, then hg rebase --continue)
   [1]
   $ hg rebase --stop --dry-run
-  abort: cannot specify both --dry-run and --stop
+  abort: cannot specify both --stop and --dry-run
   [255]
 
   $ hg rebase -s 3 -d 5
diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -332,10 +332,10 @@ 
   
 Make sure it throws error while passing --continue or --abort with --dry-run
   $ hg rebase -s 2 -d 6 -n --continue
-  abort: cannot specify both --dry-run and --continue
+  abort: cannot specify both --continue and --dry-run
   [255]
   $ hg rebase -s 2 -d 6 -n --abort
-  abort: cannot specify both --dry-run and --abort
+  abort: cannot specify both --abort and --dry-run
   [255]
 
 Check dryrun gives correct results when there is no conflict in rebasing
@@ -548,10 +548,10 @@ 
   abort: cannot specify both --confirm and --dry-run
   [255]
   $ hg rebase -s 2 -d . --confirm --abort
-  abort: cannot specify both --confirm and --abort
+  abort: cannot specify both --abort and --confirm
   [255]
   $ hg rebase -s 2 -d . --confirm --continue
-  abort: cannot specify both --confirm and --continue
+  abort: cannot specify both --continue and --confirm
   [255]
 
 Test --confirm option when there are no conflicts:
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1022,10 +1022,10 @@ 
     dryrun = opts.get(b'dry_run')
     confirm = opts.get(b'confirm')
     action = cmdutil.check_at_most_one_arg(opts, b'abort', b'stop', b'continue')
-    if dryrun and action:
-        raise error.Abort(_(b'cannot specify both --dry-run and --%s') % action)
-    if confirm and action:
-        raise error.Abort(_(b'cannot specify both --confirm and --%s') % action)
+    if action:
+        cmdutil.check_incompatible_arguments(
+            opts, action, b'confirm', b'dry_run'
+        )
     cmdutil.check_at_most_one_arg(opts, b'confirm', b'dry_run')
 
     if action or repo.currenttransaction() is not None: