Mercurial > hg
changeset 7390:0d1c770c6be1
util_win32: implement posixfile_nt.readlines()
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Tue, 18 Nov 2008 13:20:55 +0100 |
parents | 72f0e4ebd9e6 |
children | 27d304c8cc03 |
files | mercurial/util_win32.py |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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: