Patchwork [2,of,5,v2] graft: suggest the correct tool to continue (not graft)

login
register
mail settings
Submitter timeless@mozdev.org
Date Feb. 7, 2016, 7:57 a.m.
Message ID <6573cdf318d3aa45e2cd.1454831857@waste.org>
Download mbox | patch
Permalink /patch/13029/
State Superseded
Commit bd97ed1210161e5d8f848950222be53112211df4
Headers show

Comments

timeless@mozdev.org - Feb. 7, 2016, 7:57 a.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1454557544 0
#      Thu Feb 04 03:45:44 2016 +0000
# Node ID 6573cdf318d3aa45e2cd4db738d6071aadb411a5
# Parent  4a488f74e91b0347b208e0edb62f4b4d111474ba
graft: suggest the correct tool to continue (not graft)

Add test coverage for graft --continue without starting.
Suggest committing (or whatever the current activity is), via
wrongtooltocontinue which uses howtocontinue.
Pierre-Yves David - Feb. 12, 2016, 11:32 a.m.
On 02/07/2016 07:57 AM, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1454557544 0
> #      Thu Feb 04 03:45:44 2016 +0000
> # Node ID 6573cdf318d3aa45e2cd4db738d6071aadb411a5
> # Parent  4a488f74e91b0347b208e0edb62f4b4d111474ba
> graft: suggest the correct tool to continue (not graft)
>
> Add test coverage for graft --continue without starting.
> Suggest committing (or whatever the current activity is), via
> wrongtooltocontinue which uses howtocontinue.
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -3928,7 +3928,8 @@
>           except IOError as inst:
>               if inst.errno != errno.ENOENT:
>                   raise
> -            raise error.Abort(_("no graft state found, can't continue"))
> +            cmdutil.wrongtooltocontinue(repo,
> +                _("no graft state found, can't continue"))
>       else:
>           cmdutil.checkunfinished(repo)
>           cmdutil.bailifchanged(repo)
> diff --git a/tests/test-graft.t b/tests/test-graft.t
> --- a/tests/test-graft.t
> +++ b/tests/test-graft.t
> @@ -40,6 +40,14 @@
>     |
>     o  test@0.public: 0
>
> +Can't continue without starting:
> +
> +  $ hg rm -q e
> +  $ hg graft --continue
> +  abort: no graft state found, can't continue

no "graft state found" is not super clear for a end user as it expose 
some internal details. You used "no XXX in progress" for the other 
action, I think we should use it here too.
timeless - Feb. 12, 2016, 7:10 p.m.
Pierre-Yves David wrote:
> no "graft state found" is not super clear for a end user as it expose some
> internal details. You used "no XXX in progress" for the other action, I
> think we should use it here too.

Oh, I definitely choked when I saw that, but it isn't me.
I just didn't want to lengthen the series to fix that too.

I'm +1 on fixing it.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3928,7 +3928,8 @@ 
         except IOError as inst:
             if inst.errno != errno.ENOENT:
                 raise
-            raise error.Abort(_("no graft state found, can't continue"))
+            cmdutil.wrongtooltocontinue(repo,
+                _("no graft state found, can't continue"))
     else:
         cmdutil.checkunfinished(repo)
         cmdutil.bailifchanged(repo)
diff --git a/tests/test-graft.t b/tests/test-graft.t
--- a/tests/test-graft.t
+++ b/tests/test-graft.t
@@ -40,6 +40,14 @@ 
   |
   o  test@0.public: 0
   
+Can't continue without starting:
+
+  $ hg rm -q e
+  $ hg graft --continue
+  abort: no graft state found, can't continue
+  (continue: hg commit)
+  [255]
+  $ hg revert -r . -q e
 
 Need to specify a rev: