Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
27696:e70c97cc9243 | 27697:0ce0cfee497f |
---|---|
41 You can also either configure the method option in the email section | 41 You can also either configure the method option in the email section |
42 to be a sendmail compatible mailer or fill out the [smtp] section so | 42 to be a sendmail compatible mailer or fill out the [smtp] section so |
43 that the patchbomb extension can automatically send patchbombs | 43 that the patchbomb extension can automatically send patchbombs |
44 directly from the commandline. See the [email] and [smtp] sections in | 44 directly from the commandline. See the [email] and [smtp] sections in |
45 hgrc(5) for details. | 45 hgrc(5) for details. |
46 | |
47 By default, :hg:`email` will prompt for a ``To`` or ``CC`` header if | |
48 you do not supply one via configuration or the command line. You can | |
49 override this to never prompt by configuring an empty value:: | |
50 | |
51 [email] | |
52 cc = | |
46 | 53 |
47 You can control the default inclusion of an introduction message with the | 54 You can control the default inclusion of an introduction message with the |
48 ``patchbomb.intro`` configuration option. The configuration is always | 55 ``patchbomb.intro`` configuration option. The configuration is always |
49 overwritten by command line flags like --intro and --desc:: | 56 overwritten by command line flags like --intro and --desc:: |
50 | 57 |
594 showaddrs.append('%s: %s' % (header, ', '.join(addrs))) | 601 showaddrs.append('%s: %s' % (header, ', '.join(addrs))) |
595 return mail.addrlistencode(ui, addrs, _charsets, opts.get('test')) | 602 return mail.addrlistencode(ui, addrs, _charsets, opts.get('test')) |
596 | 603 |
597 # not on the command line: fallback to config and then maybe ask | 604 # not on the command line: fallback to config and then maybe ask |
598 addr = (ui.config('email', configkey) or | 605 addr = (ui.config('email', configkey) or |
599 ui.config('patchbomb', configkey) or | 606 ui.config('patchbomb', configkey)) |
600 '') | 607 if not addr: |
601 if not addr and ask: | 608 specified = (ui.hasconfig('email', configkey) or |
602 addr = prompt(ui, header, default=default) | 609 ui.hasconfig('patchbomb', configkey)) |
610 if not specified and ask: | |
611 addr = prompt(ui, header, default=default) | |
603 if addr: | 612 if addr: |
604 showaddrs.append('%s: %s' % (header, addr)) | 613 showaddrs.append('%s: %s' % (header, addr)) |
605 return mail.addrlistencode(ui, [addr], _charsets, opts.get('test')) | 614 return mail.addrlistencode(ui, [addr], _charsets, opts.get('test')) |
606 else: | 615 else: |
607 return default | 616 return default |