chunkbuffer: use list instead of cStringIO
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Sat, 24 Jul 2010 15:21:39 +0200
changeset 11667 78d1e92ba1c0
parent 11666 def08249d4db
child 11668 f070d284994c
chunkbuffer: use list instead of cStringIO
mercurial/util.py
--- a/mercurial/util.py	Sat Jul 24 15:20:29 2010 +0200
+++ b/mercurial/util.py	Sat Jul 24 15:21:39 2010 +0200
@@ -15,7 +15,7 @@
 
 from i18n import _
 import error, osutil, encoding
-import cStringIO, errno, re, shutil, sys, tempfile, traceback
+import errno, re, shutil, sys, tempfile, traceback
 import os, stat, time, calendar, textwrap, unicodedata, signal
 import imp
 
@@ -924,17 +924,16 @@
         if l > len(self.buf) and self.iter:
             # Clamp to a multiple of self.targetsize
             targetsize = max(l, self.targetsize)
-            collector = cStringIO.StringIO()
-            collector.write(self.buf)
+            collector = [str(self.buf)]
             collected = len(self.buf)
             for chunk in self.iter:
-                collector.write(chunk)
+                collector.append(chunk)
                 collected += len(chunk)
                 if collected >= targetsize:
                     break
             else:
                 self.iter = False
-            self.buf = collector.getvalue()
+            self.buf = ''.join(collector)
         if len(self.buf) == l:
             s, self.buf = str(self.buf), ''
         else: