diff hgext/patchbomb.py @ 28861:86db5cb55d46

pycompat: switch to util.stringio for py3 compat
author timeless <timeless@mozdev.org>
date Sun, 10 Apr 2016 20:55:37 +0000
parents 00e6e0d0bfeb
children 66e647312d30
line wrap: on
line diff
--- a/hgext/patchbomb.py	Sun Apr 10 21:32:08 2016 +0000
+++ b/hgext/patchbomb.py	Sun Apr 10 20:55:37 2016 +0000
@@ -65,7 +65,6 @@
 '''
 from __future__ import absolute_import
 
-import cStringIO
 import email as emailmod
 import errno
 import os
@@ -83,6 +82,7 @@
     scmutil,
     util,
 )
+stringio = util.stringio
 from mercurial.i18n import _
 
 cmdtable = {}
@@ -228,7 +228,7 @@
         if r == prev and (repo[None].files() or repo[None].deleted()):
             ui.warn(_('warning: working directory has '
                       'uncommitted changes\n'))
-        output = cStringIO.StringIO()
+        output = stringio()
         cmdutil.export(repo, [r], fp=output,
                      opts=patch.difffeatureopts(ui, opts, git=True))
         yield output.getvalue().split('\n')
@@ -721,7 +721,7 @@
             if not mbox:
                 # Exim does not remove the Bcc field
                 del m['Bcc']
-            fp = cStringIO.StringIO()
+            fp = stringio()
             generator = emailmod.Generator.Generator(fp, mangle_from_=False)
             generator.flatten(m, 0)
             sendmail(sender_addr, to + bcc + cc, fp.getvalue())