changeset 27150:88aaddb1af88

patchbomb: rename email function I see no reason for the function not to be email ...
author timeless <timeless@mozdev.org>
date Sun, 29 Nov 2015 06:51:23 +0000
parents 2f804a38351e
children 7625f6387fc4
files hgext/patchbomb.py
diffstat 1 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/patchbomb.py	Sun Nov 29 06:51:23 2015 +0000
+++ b/hgext/patchbomb.py	Sun Nov 29 06:51:23 2015 +0000
@@ -58,7 +58,7 @@
 '''
 
 import os, errno, socket, tempfile, cStringIO
-import email
+import email as emailmod
 
 from mercurial import cmdutil, commands, hg, mail, patch, util, error
 from mercurial import scmutil
@@ -155,7 +155,7 @@
         body += '\n'.join(patchlines)
 
     if addattachment:
-        msg = email.MIMEMultipart.MIMEMultipart()
+        msg = emailmod.MIMEMultipart.MIMEMultipart()
         if body:
             msg.attach(mail.mimeencode(ui, body, _charsets, opts.get('test')))
         p = mail.mimetextpatch('\n'.join(patchlines), 'x-patch',
@@ -272,15 +272,15 @@
             or prompt(ui, 'Subject:', 'A bundle for your repository'))
 
     body = _getdescription(repo, '', sender, **opts)
-    msg = email.MIMEMultipart.MIMEMultipart()
+    msg = emailmod.MIMEMultipart.MIMEMultipart()
     if body:
         msg.attach(mail.mimeencode(ui, body, _charsets, opts.get('test')))
-    datapart = email.MIMEBase.MIMEBase('application', 'x-mercurial-bundle')
+    datapart = emailmod.MIMEBase.MIMEBase('application', 'x-mercurial-bundle')
     datapart.set_payload(bundle)
     bundlename = '%s.hg' % opts.get('bundlename', 'bundle')
     datapart.add_header('Content-Disposition', 'attachment',
                         filename=bundlename)
-    email.Encoders.encode_base64(datapart)
+    emailmod.Encoders.encode_base64(datapart)
     msg.attach(datapart)
     msg['Subject'] = mail.headencode(ui, subj, _charsets, opts.get('test'))
     return [(msg, subj, None)]
@@ -403,7 +403,7 @@
     ('', 'intro', None, _('send an introduction email for a single patch')),
     ] + emailopts + commands.remoteopts,
     _('hg email [OPTION]... [DEST]...'))
-def patchbomb(ui, repo, *revs, **opts):
+def email(ui, repo, *revs, **opts):
     '''send changesets by email
 
     By default, diffs are sent in the format generated by
@@ -641,7 +641,7 @@
         if not parent.endswith('>'):
             parent += '>'
 
-    sender_addr = email.Utils.parseaddr(sender)[1]
+    sender_addr = emailmod.Utils.parseaddr(sender)[1]
     sender = mail.addressencode(ui, sender, _charsets, opts.get('test'))
     sendmail = None
     firstpatch = None
@@ -660,7 +660,7 @@
             parent = m['Message-Id']
 
         m['User-Agent'] = 'Mercurial-patchbomb/%s' % util.version()
-        m['Date'] = email.Utils.formatdate(start_time[0], localtime=True)
+        m['Date'] = emailmod.Utils.formatdate(start_time[0], localtime=True)
 
         start_time = (start_time[0] + 1, start_time[1])
         m['From'] = sender
@@ -678,7 +678,7 @@
                 fp = util.popen(os.environ['PAGER'], 'w')
             else:
                 fp = ui
-            generator = email.Generator.Generator(fp, mangle_from_=False)
+            generator = emailmod.Generator.Generator(fp, mangle_from_=False)
             try:
                 generator.flatten(m, 0)
                 fp.write('\n')
@@ -702,7 +702,7 @@
                 # Exim does not remove the Bcc field
                 del m['Bcc']
             fp = cStringIO.StringIO()
-            generator = email.Generator.Generator(fp, mangle_from_=False)
+            generator = emailmod.Generator.Generator(fp, mangle_from_=False)
             generator.flatten(m, 0)
             sendmail(sender_addr, to + bcc + cc, fp.getvalue())