[PATCH 3 of 4] patchbomb: only prompt for cc when --to not given

Christian Ebert blacktrash at gmx.net
Sat Jan 23 06:37:11 CST 2010


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1264249708 -3600
# Node ID e5abb13f80c0db1f2d7f0e0739cae4c759eae491
# Parent  855b25dacd80aebf9b60192e0a0af0c526044241
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, 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)

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)

cc                to       to (prompt), cc (opts)
cc       to       NO       to (hgrc), cc (opts)
cc       cc       cc       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 (opts), 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