Patchwork D7644: rebase: use cmdutil.check_incompatible_arguments() for --auto-orphans

login
register
mail settings
Submitter phabricator
Date Dec. 16, 2019, 11:20 p.m.
Message ID <008b7da29d2fc27e026f16c36817b32a@localhost.localdomain>
Download mbox | patch
Permalink /patch/43884/
State Not Applicable
Headers show

Comments

phabricator - Dec. 16, 2019, 11:20 p.m.
martinvonz retitled this revision from "rebase: use cmdutil.check_unique_argument() for --auto-orphans" to "rebase: use cmdutil.check_incompatible_arguments() for --auto-orphans".
martinvonz updated this revision to Diff 18771.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7644?vs=18714&id=18771

BRANCH
  default

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

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

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

CHANGE DETAILS




To: martinvonz, #hg-reviewers
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
@@ -487,7 +487,7 @@ 
   $ cp -R hidden stabilize
   $ cd stabilize
   $ hg rebase --auto-orphans '0::' -d 10
-  abort: --auto-orphans is incompatible with --dest
+  abort: cannot specify both --auto_orphans and --dest
   [255]
   $ hg rebase --auto-orphans '0::'
   rebasing 9:cf44d2f5a9f4 "D"
@@ -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/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1034,11 +1034,11 @@ 
         inmemory = False
 
     if opts.get(b'auto_orphans'):
-        for key in opts:
-            if key != b'auto_orphans' and opts.get(key):
-                raise error.Abort(
-                    _(b'--auto-orphans is incompatible with %s') % (b'--' + key)
-                )
+        disallowed_opts = set(opts) - {b'auto_orphans'}
+        cmdutil.check_incompatible_arguments(
+            opts, b'auto_orphans', *disallowed_opts
+        )
+
         userrevs = list(repo.revs(opts.get(b'auto_orphans')))
         opts[b'rev'] = [revsetlang.formatspec(b'%ld and orphan()', userrevs)]
         opts[b'dest'] = b'_destautoorphanrebase(SRC)'