[MERGE] Make Tree.get_file_text and Tree.get_file_lines official
Aaron Bentley
aaron at aaronbentley.com
Wed Oct 22 18:24:37 BST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
John Arbash Meinel wrote:
> As 'osutils.splitlines()' is pretty bad at performance, I would rather
> only use it when we need to.
>
> I'm pretty sure that as long as you always open the file in binary mode,
> then win32/mac osx/linux will actually return the same bytes from
> 'readlines()'. I suppose Mac OS 9 would return something different, but
> I don't believe that is a supported platform.
> Do you have a specific case where you *know* that the results are
> varying by platform, or is it just something that you think is happening?
I was playing it safe. I knew about OS 9. I thought Windows might
split on '\r\n', but it actually splits on '\n'.
So I suppose it's okay to use readlines on file objects, even though bad
line splitting can be very dangerous.
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkj/YdUACgkQ0F+nu1YWqI0MaQCghR8vlUfpdTg9zKSFWmAw6y5f
z7AAn1pn8x4y1Uu7cmyq0EzFcSqit3z3
=VfXB
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list