changeset 7192:f31ba106fc19

patchbomb: mime-encode clean utf-8 patches (issue814) Fixes issue814, but only for utf.
author Christian Ebert <blacktrash@gmx.net>
date Mon, 20 Oct 2008 17:40:29 +0200
parents d14212218582
children 12fc42c78598
files hgext/patchbomb.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/patchbomb.py	Mon Oct 20 17:40:29 2008 +0200
+++ b/hgext/patchbomb.py	Mon Oct 20 17:40:29 2008 +0200
@@ -62,7 +62,7 @@
 That should be all. Now your patchbomb is on its way out.'''
 
 import os, errno, socket, tempfile, cStringIO
-import email.MIMEMultipart, email.MIMEText, email.MIMEBase
+import email.MIMEMultipart, email.MIMEBase
 import email.Utils, email.Encoders, email.Generator
 from mercurial import cmdutil, commands, hg, mail, patch, util
 from mercurial.i18n import _
@@ -180,7 +180,8 @@
             if body:
                 msg.attach(mail.mimeencode(ui, body, _charsets,
                                            opts.get('test')))
-            p = email.MIMEText.MIMEText('\n'.join(patch), 'x-patch')
+            p = mail.mimetextpatch('\n'.join(patch), 'x-patch',
+                                   opts.get('test'))
             binnode = bin(node)
             # if node is mq patch, it will have patch file name as tag
             patchname = [t for t in repo.nodetags(binnode)
@@ -199,7 +200,7 @@
             msg.attach(p)
         else:
             body += '\n'.join(patch)
-            msg = email.MIMEText.MIMEText(body)
+            msg = mail.mimetextpatch(body, display=opts.get('test'))
 
         subj = desc[0].strip().rstrip('. ')
         if total == 1: