mail: import email.utils not email.Utils
email.Utils was renamed to email.utils in Python 2.5. But it appears
at some point before Python 2.7 (possibly 2.5) email.Utils was aliased
to the new home. So email.utils should be safe for all versions of
Python we support.
Differential Revision: https://phab.mercurial-scm.org/D2168
--- a/mercurial/mail.py Sun Feb 11 18:50:24 2018 -0800
+++ b/mercurial/mail.py Sun Feb 11 18:58:45 2018 -0800
@@ -288,13 +288,13 @@
addr = addr.encode('ascii')
except UnicodeDecodeError:
raise error.Abort(_('invalid local address: %s') % addr)
- return email.Utils.formataddr((name, addr))
+ return email.utils.formataddr((name, addr))
def addressencode(ui, address, charsets=None, display=False):
'''Turns address into RFC-2047 compliant header.'''
if display or not address:
return address or ''
- name, addr = email.Utils.parseaddr(address)
+ name, addr = email.utils.parseaddr(address)
return _addressencode(ui, name, addr, charsets)
def addrlistencode(ui, addrs, charsets=None, display=False):
@@ -305,7 +305,7 @@
return [a.strip() for a in addrs if a.strip()]
result = []
- for name, addr in email.Utils.getaddresses(addrs):
+ for name, addr in email.utils.getaddresses(addrs):
if name or addr:
result.append(_addressencode(ui, name, addr, charsets))
return result