Show More
@@ -58,7 +58,7 b' You can set patchbomb to always ask for ' | |||||
58 | ''' |
|
58 | ''' | |
59 |
|
59 | |||
60 | import os, errno, socket, tempfile, cStringIO |
|
60 | import os, errno, socket, tempfile, cStringIO | |
61 | import email |
|
61 | import email as emailmod | |
62 |
|
62 | |||
63 | from mercurial import cmdutil, commands, hg, mail, patch, util, error |
|
63 | from mercurial import cmdutil, commands, hg, mail, patch, util, error | |
64 | from mercurial import scmutil |
|
64 | from mercurial import scmutil | |
@@ -155,7 +155,7 b' def makepatch(ui, repo, patchlines, opts' | |||||
155 | body += '\n'.join(patchlines) |
|
155 | body += '\n'.join(patchlines) | |
156 |
|
156 | |||
157 | if addattachment: |
|
157 | if addattachment: | |
158 | msg = email.MIMEMultipart.MIMEMultipart() |
|
158 | msg = emailmod.MIMEMultipart.MIMEMultipart() | |
159 | if body: |
|
159 | if body: | |
160 | msg.attach(mail.mimeencode(ui, body, _charsets, opts.get('test'))) |
|
160 | msg.attach(mail.mimeencode(ui, body, _charsets, opts.get('test'))) | |
161 | p = mail.mimetextpatch('\n'.join(patchlines), 'x-patch', |
|
161 | p = mail.mimetextpatch('\n'.join(patchlines), 'x-patch', | |
@@ -272,15 +272,15 b' def _getbundlemsgs(repo, sender, bundle,' | |||||
272 | or prompt(ui, 'Subject:', 'A bundle for your repository')) |
|
272 | or prompt(ui, 'Subject:', 'A bundle for your repository')) | |
273 |
|
273 | |||
274 | body = _getdescription(repo, '', sender, **opts) |
|
274 | body = _getdescription(repo, '', sender, **opts) | |
275 | msg = email.MIMEMultipart.MIMEMultipart() |
|
275 | msg = emailmod.MIMEMultipart.MIMEMultipart() | |
276 | if body: |
|
276 | if body: | |
277 | msg.attach(mail.mimeencode(ui, body, _charsets, opts.get('test'))) |
|
277 | msg.attach(mail.mimeencode(ui, body, _charsets, opts.get('test'))) | |
278 | datapart = email.MIMEBase.MIMEBase('application', 'x-mercurial-bundle') |
|
278 | datapart = emailmod.MIMEBase.MIMEBase('application', 'x-mercurial-bundle') | |
279 | datapart.set_payload(bundle) |
|
279 | datapart.set_payload(bundle) | |
280 | bundlename = '%s.hg' % opts.get('bundlename', 'bundle') |
|
280 | bundlename = '%s.hg' % opts.get('bundlename', 'bundle') | |
281 | datapart.add_header('Content-Disposition', 'attachment', |
|
281 | datapart.add_header('Content-Disposition', 'attachment', | |
282 | filename=bundlename) |
|
282 | filename=bundlename) | |
283 | email.Encoders.encode_base64(datapart) |
|
283 | emailmod.Encoders.encode_base64(datapart) | |
284 | msg.attach(datapart) |
|
284 | msg.attach(datapart) | |
285 | msg['Subject'] = mail.headencode(ui, subj, _charsets, opts.get('test')) |
|
285 | msg['Subject'] = mail.headencode(ui, subj, _charsets, opts.get('test')) | |
286 | return [(msg, subj, None)] |
|
286 | return [(msg, subj, None)] | |
@@ -403,7 +403,7 b' emailopts = [' | |||||
403 | ('', 'intro', None, _('send an introduction email for a single patch')), |
|
403 | ('', 'intro', None, _('send an introduction email for a single patch')), | |
404 | ] + emailopts + commands.remoteopts, |
|
404 | ] + emailopts + commands.remoteopts, | |
405 | _('hg email [OPTION]... [DEST]...')) |
|
405 | _('hg email [OPTION]... [DEST]...')) | |
406 |
def |
|
406 | def email(ui, repo, *revs, **opts): | |
407 | '''send changesets by email |
|
407 | '''send changesets by email | |
408 |
|
408 | |||
409 | By default, diffs are sent in the format generated by |
|
409 | By default, diffs are sent in the format generated by | |
@@ -641,7 +641,7 b' def patchbomb(ui, repo, *revs, **opts):' | |||||
641 | if not parent.endswith('>'): |
|
641 | if not parent.endswith('>'): | |
642 | parent += '>' |
|
642 | parent += '>' | |
643 |
|
643 | |||
644 | sender_addr = email.Utils.parseaddr(sender)[1] |
|
644 | sender_addr = emailmod.Utils.parseaddr(sender)[1] | |
645 | sender = mail.addressencode(ui, sender, _charsets, opts.get('test')) |
|
645 | sender = mail.addressencode(ui, sender, _charsets, opts.get('test')) | |
646 | sendmail = None |
|
646 | sendmail = None | |
647 | firstpatch = None |
|
647 | firstpatch = None | |
@@ -660,7 +660,7 b' def patchbomb(ui, repo, *revs, **opts):' | |||||
660 | parent = m['Message-Id'] |
|
660 | parent = m['Message-Id'] | |
661 |
|
661 | |||
662 | m['User-Agent'] = 'Mercurial-patchbomb/%s' % util.version() |
|
662 | m['User-Agent'] = 'Mercurial-patchbomb/%s' % util.version() | |
663 | m['Date'] = email.Utils.formatdate(start_time[0], localtime=True) |
|
663 | m['Date'] = emailmod.Utils.formatdate(start_time[0], localtime=True) | |
664 |
|
664 | |||
665 | start_time = (start_time[0] + 1, start_time[1]) |
|
665 | start_time = (start_time[0] + 1, start_time[1]) | |
666 | m['From'] = sender |
|
666 | m['From'] = sender | |
@@ -678,7 +678,7 b' def patchbomb(ui, repo, *revs, **opts):' | |||||
678 | fp = util.popen(os.environ['PAGER'], 'w') |
|
678 | fp = util.popen(os.environ['PAGER'], 'w') | |
679 | else: |
|
679 | else: | |
680 | fp = ui |
|
680 | fp = ui | |
681 | generator = email.Generator.Generator(fp, mangle_from_=False) |
|
681 | generator = emailmod.Generator.Generator(fp, mangle_from_=False) | |
682 | try: |
|
682 | try: | |
683 | generator.flatten(m, 0) |
|
683 | generator.flatten(m, 0) | |
684 | fp.write('\n') |
|
684 | fp.write('\n') | |
@@ -702,7 +702,7 b' def patchbomb(ui, repo, *revs, **opts):' | |||||
702 | # Exim does not remove the Bcc field |
|
702 | # Exim does not remove the Bcc field | |
703 | del m['Bcc'] |
|
703 | del m['Bcc'] | |
704 | fp = cStringIO.StringIO() |
|
704 | fp = cStringIO.StringIO() | |
705 | generator = email.Generator.Generator(fp, mangle_from_=False) |
|
705 | generator = emailmod.Generator.Generator(fp, mangle_from_=False) | |
706 | generator.flatten(m, 0) |
|
706 | generator.flatten(m, 0) | |
707 | sendmail(sender_addr, to + bcc + cc, fp.getvalue()) |
|
707 | sendmail(sender_addr, to + bcc + cc, fp.getvalue()) | |
708 |
|
708 |
General Comments 0
You need to be logged in to leave comments.
Login now