[PATCH 2 of 2] patchbomb: with --verbose display series summary and ask for confirmation
Christian Ebert
blacktrash at gmx.net
Tue Feb 2 04:02:29 CST 2010
* Greg Ward on Sunday, January 31, 2010 at 16:32:25 -0500
> On Sun, Jan 31, 2010 at 4:11 PM, Greg Ward <greg-hg at gerg.ca> wrote:
>> Idea #1: if patchbomb.sendprompt true, ui.write() the summary and
>> prompt the user.
>>
>> Idea #2: keep your existing use of ui.note() for the summary, and have
>> patchbomb.sendprompt control only the prompt. (As long as the user
>> gets a *short* summary before the "are you sure?" prompt.)
>>
>> I'll play with it and see what I like.
>
> I've played around and I like idea #1 better. Requiring -v for a
> fully summary makes the "sending messages" output noisier than
> necessary. Here's what the last bit of your patch turns into:
>
> @@ -402,6 +404,22 @@
> cc = getaddrs('cc', askcc and 'Cc' or '', '')
> bcc = getaddrs('bcc')
>
> + # if configured, show a summary of the patchbomb and prompt for
> + # confirmation before sending
> + promptsend = ui.configbool('patchbomb', 'promptsend', default=False)
> + if promptsend:
> + # display first subject only when 1) subject was not prompted
> + # for or 2) returning from editing intro
> + displaymsgs = ((opts.get('subject') or not opts.get('desc')) and
> + msgs or msgs[1:])
> + for m, subj in displaymsgs:
> + ui.write('Subject: %s\n' % subj)
> + ui.write('From: %s\n' % sender)
> +
> + resp = prompt(ui, _('are you sure you want to send?'), 'y')
> + if resp.lower() != 'y':
> + return 1
> +
> ui.write('\n')
>
> parent = opts.get('in_reply_to') or None
>
> What do you think?
You have to do the if promptsend: ui.write switch inside getaddrs
too, because showing the _recipients_ at the prompt is even more
important imho ...
What do I think? I am down with a stomac flu and can't think
straight, so I think we should leave everything as it is ;-)
I know using --verbose as a prompt switch can be considered as an
/ab/use of the verbose option. OTOH, using hg email -v before the
patch doesn't make much of a difference (only the sending is more
verbose), so I actually thought it's a good place to use ui.note
and stuff.
c
--
\black\trash movie _C O W B O Y_ _C A N O E_ _C O M A_
Ein deutscher Western/A German Western
--->> http://www.blacktrash.org/underdogma/ccc.php
More information about the Mercurial-devel
mailing list