252 addattachment = opts.get('attach') or opts.get('inline') |
253 addattachment = opts.get('attach') or opts.get('inline') |
253 if not addattachment or opts.get('body'): |
254 if not addattachment or opts.get('body'): |
254 body += '\n'.join(patchlines) |
255 body += '\n'.join(patchlines) |
255 |
256 |
256 if addattachment: |
257 if addattachment: |
257 msg = emailmod.MIMEMultipart.MIMEMultipart() |
258 msg = emimemultipart.MIMEMultipart() |
258 if body: |
259 if body: |
259 msg.attach(mail.mimeencode(ui, body, _charsets, opts.get('test'))) |
260 msg.attach(mail.mimeencode(ui, body, _charsets, opts.get('test'))) |
260 p = mail.mimetextpatch('\n'.join(patchlines), 'x-patch', |
261 p = mail.mimetextpatch('\n'.join(patchlines), 'x-patch', |
261 opts.get('test')) |
262 opts.get('test')) |
262 binnode = nodemod.bin(node) |
263 binnode = nodemod.bin(node) |
363 _charsets = mail._charsets(ui) |
364 _charsets = mail._charsets(ui) |
364 subj = (opts.get(r'subject') |
365 subj = (opts.get(r'subject') |
365 or prompt(ui, 'Subject:', 'A bundle for your repository')) |
366 or prompt(ui, 'Subject:', 'A bundle for your repository')) |
366 |
367 |
367 body = _getdescription(repo, '', sender, **opts) |
368 body = _getdescription(repo, '', sender, **opts) |
368 msg = emailmod.MIMEMultipart.MIMEMultipart() |
369 msg = emimemultipart.MIMEMultipart() |
369 if body: |
370 if body: |
370 msg.attach(mail.mimeencode(ui, body, _charsets, opts.get(r'test'))) |
371 msg.attach(mail.mimeencode(ui, body, _charsets, opts.get(r'test'))) |
371 datapart = emailmod.MIMEBase.MIMEBase('application', 'x-mercurial-bundle') |
372 datapart = emailmod.MIMEBase.MIMEBase('application', 'x-mercurial-bundle') |
372 datapart.set_payload(bundle) |
373 datapart.set_payload(bundle) |
373 bundlename = '%s.hg' % opts.get(r'bundlename', 'bundle') |
374 bundlename = '%s.hg' % opts.get(r'bundlename', 'bundle') |