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

login
register
mail settings
Submitter phabricator
Date Dec. 13, 2019, 7:56 a.m.
Message ID <differential-rev-PHID-DREV-lgkb2onlsxpskqk74ze6-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/43789/
State Superseded
Headers show

Comments

phabricator - Dec. 13, 2019, 7:56 a.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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
phabricator - Dec. 17, 2019, 4:02 p.m.
pulkit added inline comments.

INLINE COMMENTS

> test-rebase-obsolete.t:2057
>    $ hg rebase --stop --dry-run
> -  abort: cannot specify both --dry-run and --stop
> +  abort: cannot specify both --stop and --dry-run
>    [255]

Unrelated change?

REPOSITORY
  rHG Mercurial

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

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

To: martinvonz, #hg-reviewers
Cc: pulkit, mercurial-devel
phabricator - Dec. 17, 2019, 6:01 p.m.
martinvonz added inline comments.

INLINE COMMENTS

> pulkit wrote in test-rebase-obsolete.t:2057
> Unrelated change?

Oops, that belongs in D7661 <https://phab.mercurial-scm.org/D7661>. Thanks!

REPOSITORY
  rHG Mercurial

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

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

To: martinvonz, #hg-reviewers
Cc: pulkit, 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"
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1033,10 +1033,9 @@ 
 
     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)
-                )
+            if key != b'auto_orphans':
+                cmdutil.check_unique_argument(opts, b'auto_orphans', key)
+
         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)'