[PATCH 2 of 2 v3] patchbomb: treat empty address list as no addresses
Bryan O'Sullivan
bos at serpentine.com
Fri Jan 8 10:50:32 CST 2016
# HG changeset patch
# User Bryan O'Sullivan <bos at serpentine.com>
# Date 1452225767 28800
# Thu Jan 07 20:02:47 2016 -0800
# Node ID ac90a958512d6044bd734d46e221b040f5ab9227
# Parent 8b71747150c066ba5244adf88edff406c30db94c
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.
diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -44,6 +44,13 @@ that the patchbomb extension can automat
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 @@ def email(ui, repo, *revs, **opts):
# 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'))
diff --git a/tests/test-patchbomb.t b/tests/test-patchbomb.t
--- a/tests/test-patchbomb.t
+++ b/tests/test-patchbomb.t
@@ -2682,13 +2682,17 @@ test outgoing:
+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"
@@ -2856,7 +2860,6 @@ single rev, and introduce a deliberate f
@@ -1,1 +1,2 @@
d
+d
- Cc:
sending [PATCH] test ...
sending mail: $TESTTMP/t2/pretendmail.sh -f test foo
More information about the Mercurial-devel
mailing list