# HG changeset patch # User Patrick Mezard # Date 1227010855 -3600 # Node ID 0d1c770c6be1f977dc90a4674dce09424a131259 # Parent 72f0e4ebd9e6fb233630a7710be8d44e8cbe547d util_win32: implement posixfile_nt.readlines() diff -r 72f0e4ebd9e6 -r 0d1c770c6be1 mercurial/util_win32.py --- 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: