[PATCH 2 of 2] patchbomb: with --verbose display series summary and ask for confirmation

Greg Ward greg-hg at gerg.ca
Sun Jan 31 15:32:25 CST 2010


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?

Greg


More information about the Mercurial-devel mailing list