patchbomb: use email.mime.multipart instead of email.MIMEMultipart
authorPulkit Goyal <7895pulkit@gmail.com>
Tue, 26 Jun 2018 02:04:17 +0530
changeset 38471 91228d9ae7c8
parent 38470 4c358bdaada8
child 38472 d17d1ee1d602
patchbomb: use email.mime.multipart instead of email.MIMEMultipart The later was removed in Python 3. On python 2: >>> email.MIMEMultipart.MIMEMultipart is email.mime.multipart.MIMEMultipart True Differential Revision: https://phab.mercurial-scm.org/D3835
hgext/patchbomb.py
--- a/hgext/patchbomb.py	Tue Jun 26 01:08:47 2018 +0530
+++ b/hgext/patchbomb.py	Tue Jun 26 02:04:17 2018 +0530
@@ -75,6 +75,7 @@
 
 import email as emailmod
 import email.generator as emailgen
+import email.mime.multipart as emimemultipart
 import email.utils as eutil
 import errno
 import os
@@ -254,7 +255,7 @@
         body += '\n'.join(patchlines)
 
     if addattachment:
-        msg = emailmod.MIMEMultipart.MIMEMultipart()
+        msg = emimemultipart.MIMEMultipart()
         if body:
             msg.attach(mail.mimeencode(ui, body, _charsets, opts.get('test')))
         p = mail.mimetextpatch('\n'.join(patchlines), 'x-patch',
@@ -365,7 +366,7 @@
             or prompt(ui, 'Subject:', 'A bundle for your repository'))
 
     body = _getdescription(repo, '', sender, **opts)
-    msg = emailmod.MIMEMultipart.MIMEMultipart()
+    msg = emimemultipart.MIMEMultipart()
     if body:
         msg.attach(mail.mimeencode(ui, body, _charsets, opts.get(r'test')))
     datapart = emailmod.MIMEBase.MIMEBase('application', 'x-mercurial-bundle')