mercurial/util_win32.py
changeset 7390 0d1c770c6be1
parent 6881 d2375bbee6d4
child 7427 f21e3d0e335b
--- a/mercurial/util_win32.py	Wed Nov 19 13:27:57 2008 +0100
+++ b/mercurial/util_win32.py	Tue Nov 18 13:20:55 2008 +0100
@@ -292,7 +292,7 @@
             raise WinIOError(err, name)
 
     def __iter__(self):
-        for line in self.read().splitlines(True):
+        for line in self.readlines():
             yield line
 
     def read(self, count=-1):
@@ -311,6 +311,11 @@
         except pywintypes.error, err:
             raise WinIOError(err)
 
+    def readlines(self, sizehint=None):
+        # splitlines() splits on single '\r' while readlines()
+        # does not. cStringIO has a well behaving readlines() and is fast.
+        return cStringIO.StringIO(self.read()).readlines()
+
     def write(self, data):
         try:
             if 'a' in self.mode: