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

Christian Ebert blacktrash at gmx.net
Fri Jan 29 15:23:32 CST 2010


# 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 *):

opts     hgrc     prompt   result
                  new/old

to                NO/cc    to (opts)         *
to       to       NO/cc    to (opts)         *
to       cc       NO       to (opts), cc (hgrc)
to       to, cc   NO       to (opts), cc (hgrc)

to, cc            NO       to (opts), cc (opts)
to, cc   to       NO       to (opts), cc (opts)
to, cc   cc       NO       to (opts), cc (opts)
to, cc   to, cc   NO       to (opts), cc (opts)

cc                to       to (prompt), cc (opts)
cc       to       NO       to (hgrc), cc (opts)
cc       cc       to       to (prompt), cc (opts)
cc       to, cc   NO       to (hgrc), cc (opts)

                  to, cc   to (prompt), cc (prompt)
         to       cc       to (hgrc), cc (prompt)
         cc       to       to (prompt), cc (hgrc)
         to, cc   NO       to (hgrc), cc (hgrc)

diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -397,7 +397,7 @@
         return mail.addrlistencode(ui, [addrs], _charsets, opts.get('test'))
 
     to = getaddrs('to', 'To')
-    cc = getaddrs('cc', 'Cc', '')
+    cc = getaddrs('cc', not opts.get('to') and 'Cc', '')
     bcc = getaddrs('bcc')
 
     ui.write('\n')


More information about the Mercurial-devel mailing list