# HG changeset patch # User Augie Fackler # Date 2017-06-13 21:43:33 # Node ID 3abba5bc34546951b11b1bd3f5e5c77b90d950d1 # Parent 16ff5c6066a66971e1107dd74af1567f1414eb02 patchbomb: make getaddrs function easier to work with Prior to this the return value was potentially None, a string, or a list of strings. It now always returns a list of strings where each string is always only one email address diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py --- a/hgext/patchbomb.py +++ b/hgext/patchbomb.py @@ -660,15 +660,17 @@ def email(ui, repo, *revs, **opts): if addr: showaddrs.append('%s: %s' % (header, addr)) return mail.addrlistencode(ui, [addr], _charsets, opts.get('test')) - else: - return default + elif default: + return mail.addrlistencode( + ui, [default], _charsets, opts.get('test')) + return [] to = getaddrs('To', ask=True) if not to: # we can get here in non-interactive mode raise error.Abort(_('no recipient addresses provided')) - cc = getaddrs('Cc', ask=True, default='') or [] - bcc = getaddrs('Bcc') or [] + cc = getaddrs('Cc', ask=True, default='') + bcc = getaddrs('Bcc') replyto = getaddrs('Reply-To') confirm = ui.configbool('patchbomb', 'confirm')