changeset 11667:78d1e92ba1c0

chunkbuffer: use list instead of cStringIO
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sat, 24 Jul 2010 15:21:39 +0200
parents def08249d4db
children f070d284994c
files mercurial/util.py
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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: