Mercurial > hg-stable
changeset 27697:0ce0cfee497f
patchbomb: treat empty address list as no addresses
Previously it wasn't possible to use configuration to avoid
being prompted for e.g. a CC list when using patchbomb to send
emails.
We now make it possible to supply an empty value.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Thu, 07 Jan 2016 20:02:47 -0800 |
parents | e70c97cc9243 |
children | dad6404ccddb |
files | hgext/patchbomb.py tests/test-patchbomb.t |
diffstat | 2 files changed, 18 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/patchbomb.py Thu Jan 07 19:45:03 2016 -0800 +++ b/hgext/patchbomb.py Thu Jan 07 20:02:47 2016 -0800 @@ -44,6 +44,13 @@ directly from the commandline. See the [email] and [smtp] sections in hgrc(5) for details. +By default, :hg:`email` will prompt for a ``To`` or ``CC`` header if +you do not supply one via configuration or the command line. You can +override this to never prompt by configuring an empty value:: + + [email] + cc = + You can control the default inclusion of an introduction message with the ``patchbomb.intro`` configuration option. The configuration is always overwritten by command line flags like --intro and --desc:: @@ -596,10 +603,12 @@ # not on the command line: fallback to config and then maybe ask addr = (ui.config('email', configkey) or - ui.config('patchbomb', configkey) or - '') - if not addr and ask: - addr = prompt(ui, header, default=default) + ui.config('patchbomb', configkey)) + if not addr: + specified = (ui.hasconfig('email', configkey) or + ui.hasconfig('patchbomb', configkey)) + if not specified and ask: + addr = prompt(ui, header, default=default) if addr: showaddrs.append('%s: %s' % (header, addr)) return mail.addrlistencode(ui, [addr], _charsets, opts.get('test'))
--- a/tests/test-patchbomb.t Thu Jan 07 19:45:03 2016 -0800 +++ b/tests/test-patchbomb.t Thu Jan 07 20:02:47 2016 -0800 @@ -2682,13 +2682,17 @@ +d +Don't prompt for a CC header. + + $ echo "[email]" >> $HGRCPATH + $ echo "cc=" >> $HGRCPATH + dest#branch URIs: $ hg email --date '1980-1-1 0:1' -n -t foo -s test -o ../t#test comparing with ../t From [test]: test this patch series consists of 1 patches. - Cc: displaying [PATCH] test ... Content-Type: text/plain; charset="us-ascii" @@ -2854,7 +2858,6 @@ @@ -1,1 +1,2 @@ d +d - Cc: sending [PATCH] test ... sending mail: $TESTTMP/t2/pretendmail.sh -f test foo