[PATCH 1 of 2] patchbomb: only prompt for cc when --to not given

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


On Sat, Jan 30, 2010 at 7:07 AM, Christian Ebert <blacktrash at gmx.net> wrote:
> # HG changeset patch
> # User Christian Ebert <blacktrash at gmx.net>
> # Date 1264796750 0
> # Node ID b0d68e68c9185059432a31b0357aaf2aedcd975f
> # Parent  e7727a545c4827f3ff481175d074d065135adbec
> patchbomb: only prompt for cc when --to not given
>
> This table shows that the behaviour changes in 2 cases (marked *):

I finally got around to trying this patch out.  Unfortunately, it is
useless to me.  I did not realize that it was only triggered by
putting a recipient on the command line, and I almost always put the
patchbomb recipient in configuration.  (The only project where I
regularly use patchbomb is Mercurial itself, and there is only one
recipient that matters: mercurial-devel.)

So my usual way of sending a one-changeset patch is:

  hg email -r tip
  hit <enter> because I never supply cc addresses
  cross fingers and hope that it really sent what I want it to send

This could be improved in two ways: 1) do not waste my time with a
useless "Cc" prompt, and 2) show me a summary of what will be sent
before sending it.  I think your second patch does a good job of
addressing #2.  But your change to getting "Cc" has no effect on me.
;-(

So here is a competing idea to Christian's "Cc" patch: make the Cc
prompt configurable.

# HG changeset patch
# User Greg Ward <greg-hg at gerg.ca>
# Date 1264971099 18000
# Node ID 4117dce6d51d0d4042f7d5e56706a20f6614c3a6
# Parent  e768941f14c1b0fdb428023c58ca06bd9c9da30c
patchbomb: add config 'askcc' to control prompt for Cc addresses.

diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -396,8 +396,10 @@

         return mail.addrlistencode(ui, [addrs], _charsets, opts.get('test'))

+    askcc = ui.configbool('patchbomb', 'askcc', default=True)
+
     to = getaddrs('to', 'To')
-    cc = getaddrs('cc', 'Cc', '')
+    cc = getaddrs('cc', askcc and 'Cc' or '', '')
     bcc = getaddrs('bcc')

     ui.write('\n')

Note that setting askcc=false makes Christian's "are you sure you want
to send?" patch even more desirable!

Greg


More information about the Mercurial-devel mailing list