Patchwork D7641: rebase: use cmdutil.check_at_most_one_arg() for --confirm/--dry-run

login
register
mail settings
Submitter phabricator
Date Dec. 18, 2019, 6:47 a.m.
Message ID <9168760c21e89810cbb09b7346403290@localhost.localdomain>
Download mbox | patch
Permalink /patch/43966/
State Not Applicable
Headers show

Comments

phabricator - Dec. 18, 2019, 6:47 a.m.
Closed by commit rHGdaed70e95d60: rebase: use cmdutil.check_at_most_one_arg() for --confirm/--dry-run (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7641?vs=18819&id=18852

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

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

AFFECTED FILES
  hgext/rebase.py
  mercurial/cmdutil.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers, pulkit
Cc: yuja, mercurial-devel
Yuya Nishihara - Dec. 18, 2019, 12:44 p.m.
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -268,6 +268,7 @@
>      previous = None
>      for x in args:
>          if opts.get(x):
> +            x = x.replace(b'_', b'-')
>              if previous:
>                  raise error.Abort(
>                      _(b'cannot specify both --%s and --%s') % (previous, x)

Nit: better to return the unique argument in the original format, not
the dash-ed version.
phabricator - Dec. 18, 2019, 12:53 p.m.
yuja added a comment.


  > - a/mercurial/cmdutil.py
  >
  > +++ b/mercurial/cmdutil.py
  > @@ -268,6 +268,7 @@
  >
  >   previous = None
  >   for x in args:
  >       if opts.get(x):
  >
  > +            x = x.replace(b'_', b'-')
  >
  >   if previous:
  >       raise error.Abort(
  >           _(b'cannot specify both --%s and --%s') % (previous, x)
  
  Nit: better to return the unique argument in the original format, not
  the dash-ed version.

REPOSITORY
  rHG Mercurial

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

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

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

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -268,6 +268,7 @@ 
     previous = None
     for x in args:
         if opts.get(x):
+            x = x.replace(b'_', b'-')
             if previous:
                 raise error.Abort(
                     _(b'cannot specify both --%s and --%s') % (previous, x)
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1026,8 +1026,7 @@ 
         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 dryrun and confirm:
-        raise error.Abort(_(b'cannot specify both --confirm and --dry-run'))
+    cmdutil.check_at_most_one_arg(opts, b'confirm', b'dry_run')
 
     if action or repo.currenttransaction() is not None:
         # in-memory rebase is not compatible with resuming rebases.