Patchwork [2,of,5] dispatch: catch InterventionRequired and print the message with no prefix

login
register
mail settings
Submitter Augie Fackler
Date Feb. 8, 2013, 10:49 p.m.
Message ID <1c4102a7ec7c80a1baa9.1360363791@augie-macbookair>
Download mbox | patch
Permalink /patch/847/
State Accepted
Commit 7b4b9e8ea12e7469446d4c87426cd87da4abd9de
Headers show

Comments

Augie Fackler - Feb. 8, 2013, 10:49 p.m.
# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1360362504 21600
# Node ID 1c4102a7ec7c80a1baa98ccaf8c867ea0fd520a7
# Parent  4d997c5075c446963b6ac65155f2129c73257b6f
dispatch: catch InterventionRequired and print the message with no prefix
Mads Kiilerich - Feb. 9, 2013, 11:39 a.m.
On 02/08/2013 11:49 PM, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <raf@durin42.com>
> # Date 1360362504 21600
> # Node ID 1c4102a7ec7c80a1baa98ccaf8c867ea0fd520a7
> # Parent  4d997c5075c446963b6ac65155f2129c73257b6f
> dispatch: catch InterventionRequired and print the message with no prefix
>
> diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
> --- a/mercurial/dispatch.py
> +++ b/mercurial/dispatch.py
> @@ -151,6 +151,8 @@
>               commands.help_(ui, inst.args[0], unknowncmd=True)
>           except error.UnknownCommand:
>               commands.help_(ui, 'shortlist')
> +    except error.InterventionRequired, inst:
> +        ui.warn("%s\n" % inst)

I find it annoying that we have several exception types where we just 
display the message without giving any hint of the exception type. Many 
of the messages would make much more sense if we also showed the 
exception type.

So I suggest using a prefix here, just like we do for abort.

Perhaps something like 'interrupted:' - I think that would could give a 
consistent hint that something important but not fatal happened. (The 
exception could perhaps also be called something with Interrupt.)

>       except util.Abort, inst:
>           ui.warn(_("abort: %s\n") % inst)
>           if inst.hint:

/Mads
Bryan O'Sullivan - Feb. 11, 2013, 9:47 p.m.
On Sat, Feb 9, 2013 at 3:51 AM, Augie Fackler <raf@durin42.com> wrote:

> Open to suggestions on that - I wanted a prefix but couldn't come up with
> one that was clear and suitably pithy.
>

stopped?
Laurens Holst - Feb. 12, 2013, 11:15 a.m.
Op 11-02-13 22:47, Bryan O'Sullivan schreef:
> On Sat, Feb 9, 2013 at 3:51 AM, Augie Fackler <raf@durin42.com 
> <mailto:raf@durin42.com>> wrote:
>
>     Open to suggestions on that - I wanted a prefix but couldn't come
>     up with one that was clear and suitably pithy.
>
>
> stopped?

paused?

suspended?

needsinput?

I like interrupted too, btw.

It's fairly analogous to breakpoints in a debugger, might be able to use 
the terminology used there.

~Laurens
Pierre-Yves David - Feb. 13, 2013, 4:34 p.m.
On Wed, Feb 13, 2013 at 10:24:57AM -0600, Kevin Bullock wrote:
> On Feb 12, 2013, at 5:15 AM, Laurens Holst wrote:
> 
> > Op 11-02-13 22:47, Bryan O'Sullivan schreef:
> >> On Sat, Feb 9, 2013 at 3:51 AM, Augie Fackler <raf@durin42.com> wrote:
> >> Open to suggestions on that - I wanted a prefix but couldn't come up with one that was clear and suitably pithy.
> >> 
> >> stopped? 
> > 
> > paused?
> > 
> > suspended?
> 
> stopped, suspended, interrupted all sound okay to me.

"interrupted" is very similar to what mercurial print on SIGINT we can
not use it.

"suspended" ring a SIGSTOP bell for me.


I'm not a fan of stop but it sound ok

- "pause" sound ok to me too.
- "stall" ?
- "delay" ?
- "block"

note: what we really want to say is: HALP ME HUMAN I'M JUST A COMPUTER

Patch

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -151,6 +151,8 @@ 
             commands.help_(ui, inst.args[0], unknowncmd=True)
         except error.UnknownCommand:
             commands.help_(ui, 'shortlist')
+    except error.InterventionRequired, inst:
+        ui.warn("%s\n" % inst)
     except util.Abort, inst:
         ui.warn(_("abort: %s\n") % inst)
         if inst.hint: