Mercurial > public > mercurial-scm > hg-stable
diff hgext/patchbomb.py @ 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 | 88aaddb1af88 |
children | ddfb8887212d |
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'))