The later was removed in Python 3.
On python 2:
email.MIMEMultipart.MIMEMultipart is email.mime.multipart.MIMEMultipart
True
hg-reviewers |
The later was removed in Python 3.
On python 2:
email.MIMEMultipart.MIMEMultipart is email.mime.multipart.MIMEMultipart
True
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Path | Packages | |||
---|---|---|---|---|
M | hgext/patchbomb.py (5 lines) |
You can set patchbomb to always ask for confirmation by setting | You can set patchbomb to always ask for confirmation by setting | ||||
``patchbomb.confirm`` to true. | ``patchbomb.confirm`` to true. | ||||
''' | ''' | ||||
from __future__ import absolute_import | from __future__ import absolute_import | ||||
import email as emailmod | import email as emailmod | ||||
import email.generator as emailgen | import email.generator as emailgen | ||||
import email.mime.multipart as emimemultipart | |||||
import email.utils as eutil | import email.utils as eutil | ||||
import errno | import errno | ||||
import os | import os | ||||
import socket | import socket | ||||
from mercurial.i18n import _ | from mercurial.i18n import _ | ||||
from mercurial import ( | from mercurial import ( | ||||
cmdutil, | cmdutil, | ||||
if opts.get('diffstat'): | if opts.get('diffstat'): | ||||
body += ds + '\n\n' | body += ds + '\n\n' | ||||
addattachment = opts.get('attach') or opts.get('inline') | addattachment = opts.get('attach') or opts.get('inline') | ||||
if not addattachment or opts.get('body'): | if not addattachment or opts.get('body'): | ||||
body += '\n'.join(patchlines) | body += '\n'.join(patchlines) | ||||
if addattachment: | if addattachment: | ||||
msg = emailmod.MIMEMultipart.MIMEMultipart() | msg = emimemultipart.MIMEMultipart() | ||||
if body: | if body: | ||||
msg.attach(mail.mimeencode(ui, body, _charsets, opts.get('test'))) | msg.attach(mail.mimeencode(ui, body, _charsets, opts.get('test'))) | ||||
p = mail.mimetextpatch('\n'.join(patchlines), 'x-patch', | p = mail.mimetextpatch('\n'.join(patchlines), 'x-patch', | ||||
opts.get('test')) | opts.get('test')) | ||||
binnode = nodemod.bin(node) | binnode = nodemod.bin(node) | ||||
# if node is mq patch, it will have the patch file's name as a tag | # if node is mq patch, it will have the patch file's name as a tag | ||||
if not patchname: | if not patchname: | ||||
patchtags = [t for t in repo.nodetags(binnode) | patchtags = [t for t in repo.nodetags(binnode) | ||||
The list is always one message long in that case. | The list is always one message long in that case. | ||||
""" | """ | ||||
ui = repo.ui | ui = repo.ui | ||||
_charsets = mail._charsets(ui) | _charsets = mail._charsets(ui) | ||||
subj = (opts.get(r'subject') | subj = (opts.get(r'subject') | ||||
or prompt(ui, 'Subject:', 'A bundle for your repository')) | or prompt(ui, 'Subject:', 'A bundle for your repository')) | ||||
body = _getdescription(repo, '', sender, **opts) | body = _getdescription(repo, '', sender, **opts) | ||||
msg = emailmod.MIMEMultipart.MIMEMultipart() | msg = emimemultipart.MIMEMultipart() | ||||
if body: | if body: | ||||
msg.attach(mail.mimeencode(ui, body, _charsets, opts.get(r'test'))) | msg.attach(mail.mimeencode(ui, body, _charsets, opts.get(r'test'))) | ||||
datapart = emailmod.MIMEBase.MIMEBase('application', 'x-mercurial-bundle') | datapart = emailmod.MIMEBase.MIMEBase('application', 'x-mercurial-bundle') | ||||
datapart.set_payload(bundle) | datapart.set_payload(bundle) | ||||
bundlename = '%s.hg' % opts.get(r'bundlename', 'bundle') | bundlename = '%s.hg' % opts.get(r'bundlename', 'bundle') | ||||
datapart.add_header('Content-Disposition', 'attachment', | datapart.add_header('Content-Disposition', 'attachment', | ||||
filename=bundlename) | filename=bundlename) | ||||
emailmod.Encoders.encode_base64(datapart) | emailmod.Encoders.encode_base64(datapart) |