Patchwork [5,of,5] shelve: omit incorrect 'commit' suggestion at 'hg shelve -i'

login
register
mail settings
Submitter Katsunori FUJIWARA
Date July 14, 2015, 7:58 p.m.
Message ID <83ca1cfef65f6653facc.1436903907@feefifofum>
Download mbox | patch
Permalink /patch/9980/
State Accepted
Commit 0eb093e40813f5867c8d19050fba318cf20aeed9
Headers show

Comments

Katsunori FUJIWARA - July 14, 2015, 7:58 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1436903158 -32400
#      Wed Jul 15 04:45:58 2015 +0900
# Node ID 83ca1cfef65f6653facc80efa77c312f6bb0673a
# Parent  b7be795042aa172e56d5a298a200c3900a598109
shelve: omit incorrect 'commit' suggestion at 'hg shelve -i'

Before this patch, 'hg shelve -i' under non-interactive mode suggests
'use commit instead', and it obviously incorrect, because what user
wants to do isn't 'commit' but 'shelve'.

To omit incorrect 'commit' suggestion at 'hg shelve -i', this patch
specifies 'None' for 'cmdsuggest' argument of 'cmdutil.dorecord()'.
Augie Fackler - July 15, 2015, 3:49 p.m.
On Wed, Jul 15, 2015 at 04:58:27AM +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> # Date 1436903158 -32400
> #      Wed Jul 15 04:45:58 2015 +0900
> # Node ID 83ca1cfef65f6653facc80efa77c312f6bb0673a
> # Parent  b7be795042aa172e56d5a298a200c3900a598109
> shelve: omit incorrect 'commit' suggestion at 'hg shelve -i'

This series looks good to me.

>
> Before this patch, 'hg shelve -i' under non-interactive mode suggests
> 'use commit instead', and it obviously incorrect, because what user
> wants to do isn't 'commit' but 'shelve'.
>
> To omit incorrect 'commit' suggestion at 'hg shelve -i', this patch
> specifies 'None' for 'cmdsuggest' argument of 'cmdutil.dorecord()'.
>
> diff --git a/hgext/shelve.py b/hgext/shelve.py
> --- a/hgext/shelve.py
> +++ b/hgext/shelve.py
> @@ -279,7 +279,7 @@
>          if not interactive:
>              node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
>          else:
> -            node = cmdutil.dorecord(ui, repo, interactivecommitfunc, 'commit',
> +            node = cmdutil.dorecord(ui, repo, interactivecommitfunc, None,
>                                      False, cmdutil.recordfilter, *pats, **opts)
>          if not node:
>              stat = repo.status(match=scmutil.match(repo[None], pats, opts))
> diff --git a/tests/test-shelve.t b/tests/test-shelve.t
> --- a/tests/test-shelve.t
> +++ b/tests/test-shelve.t
> @@ -860,6 +860,9 @@
>    $ cat foo/foo
>    foo
>    a
> +  $ hg shelve --interactive --config ui.interactive=false
> +  abort: running non-interactively
> +  [255]
>    $ hg shelve --interactive << EOF
>    > y
>    > y
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
Matt Mackall - July 15, 2015, 8:06 p.m.
On Wed, 2015-07-15 at 04:58 +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> # Date 1436903158 -32400
> #      Wed Jul 15 04:45:58 2015 +0900
> # Node ID 83ca1cfef65f6653facc80efa77c312f6bb0673a
> # Parent  b7be795042aa172e56d5a298a200c3900a598109
> shelve: omit incorrect 'commit' suggestion at 'hg shelve -i'

These are queued for default, thanks.

Patch

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -279,7 +279,7 @@ 
         if not interactive:
             node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
         else:
-            node = cmdutil.dorecord(ui, repo, interactivecommitfunc, 'commit',
+            node = cmdutil.dorecord(ui, repo, interactivecommitfunc, None,
                                     False, cmdutil.recordfilter, *pats, **opts)
         if not node:
             stat = repo.status(match=scmutil.match(repo[None], pats, opts))
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -860,6 +860,9 @@ 
   $ cat foo/foo
   foo
   a
+  $ hg shelve --interactive --config ui.interactive=false
+  abort: running non-interactively
+  [255]
   $ hg shelve --interactive << EOF
   > y
   > y