changeset 36448:39c9f339b692

py3: use email.utils module instead of email.Utils On py2: >>> import email >>> import email.utils as eutil >>> email.Utils.parseaddr is eutil.parseaddr True >>> email.Utils.formatdate is eutil.formatdate True email.Utils is not present on Python 3. Differential Revision: https://phab.mercurial-scm.org/D2453
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 26 Feb 2018 16:19:53 +0530
parents 588048a6a8d3
children a918c996a881
files hgext/patchbomb.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/patchbomb.py	Mon Feb 26 17:25:46 2018 +0530
+++ b/hgext/patchbomb.py	Mon Feb 26 16:19:53 2018 +0530
@@ -75,6 +75,7 @@
 
 import email as emailmod
 import email.generator as emailgen
+import email.utils as eutil
 import errno
 import os
 import socket
@@ -745,7 +746,7 @@
         if not parent.endswith('>'):
             parent += '>'
 
-    sender_addr = emailmod.Utils.parseaddr(sender)[1]
+    sender_addr = eutil.parseaddr(sender)[1]
     sender = mail.addressencode(ui, sender, _charsets, opts.get('test'))
     sendmail = None
     firstpatch = None
@@ -764,7 +765,7 @@
             parent = m['Message-Id']
 
         m['User-Agent'] = 'Mercurial-patchbomb/%s' % util.version()
-        m['Date'] = emailmod.Utils.formatdate(start_time[0], localtime=True)
+        m['Date'] = eutil.formatdate(start_time[0], localtime=True)
 
         start_time = (start_time[0] + 1, start_time[1])
         m['From'] = sender