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

login
register
mail settings
Submitter timeless@mozdev.org
Date Feb. 4, 2016, 3:56 a.m.
Message ID <1e8f92f555cdd026da9c.1454558181@waste.org>
Download mbox | patch
Permalink /patch/12971/
State Superseded
Commit bd97ed1210161e5d8f848950222be53112211df4
Headers show

Comments

timeless@mozdev.org - Feb. 4, 2016, 3:56 a.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1454557544 0
#      Thu Feb 04 03:45:44 2016 +0000
# Node ID 1e8f92f555cdd026da9cdc8f65f144ab5f16f1c8
# Parent  9606a1513d812239259485be8469a1493faa60bf
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.
Augie Fackler - Feb. 5, 2016, 9:54 p.m.
On Wed, Feb 03, 2016 at 09:56:21PM -0600, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1454557544 0
> #      Thu Feb 04 03:45:44 2016 +0000
> # Node ID 1e8f92f555cdd026da9cdc8f65f144ab5f16f1c8
> # Parent  9606a1513d812239259485be8469a1493faa60bf
> 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.

I like where this series is going, but what happens if I try to 'hg
graft --continue' and it's actually a histedit in progress? Or a
rebase? Can I get some tests around that in at least one or two places?

>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -3917,7 +3917,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:
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Pierre-Yves David - Feb. 11, 2016, 10:13 p.m.
On 02/05/2016 09:54 PM, Augie Fackler wrote:
> On Wed, Feb 03, 2016 at 09:56:21PM -0600, timeless wrote:
>> # HG changeset patch
>> # User timeless <timeless@mozdev.org>
>> # Date 1454557544 0
>> #      Thu Feb 04 03:45:44 2016 +0000
>> # Node ID 1e8f92f555cdd026da9cdc8f65f144ab5f16f1c8
>> # Parent  9606a1513d812239259485be8469a1493faa60bf
>> 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.
>
> I like where this series is going, but what happens if I try to 'hg
> graft --continue' and it's actually a histedit in progress? Or a
> rebase? Can I get some tests around that in at least one or two places?\

I've the very same question. Suspense is peaking!
timeless - Feb. 12, 2016, 7:08 p.m.
Augue wrote:
> I like where this series is going, but what happens if I try to 'hg
> graft --continue' and it's actually a histedit in progress? Or a
> rebase? Can I get some tests around that in at least one or two places?

Sorry, I updated the series a while ago with the additional tests.

The answer is "the right thing (tm)".

I didn't initially include those tests because I didn't spend the time
looking for where to add them.

Pierre-Yves David wrote:
> I've the very same question. Suspense is peaking!

And I resent (and now I realize I've resent twice).

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3917,7 +3917,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: