[MERGE] Make annotate behave in a non-ASCII world (v1)
John Arbash Meinel
john at arbash-meinel.com
Fri Jul 6 20:25:12 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Adeodato Simó wrote:
> * John Arbash Meinel [Fri, 06 Jul 2007 14:50:28 -0400]:
>
>> John Arbash Meinel has voted +1 (conditional).
>> Status is now: Semi-approved
>> Comment:
>> to_file.encoding can be None (it happens when you redirect stdout such as:
>> bzr annotate foo | vim -R -)
>
> No, it really can't. From the top of the function:
>
> if to_file is None:
> to_file = sys.stdout
I'm not saying that 'to_file' can be None, I'm saying that 'to_file.encoding'
can be None.
try doing:
python -c 'import sys; print sys.stdout.encoding' | less
>
>> We should also have a test for that. You might look at
>> bzrlib.tests.StringIOWrapper which allows you to set an 'encoding'
>> attribute on a StringIO object. (This is especially important because it is
>> a time when you are fairly likely to get an encoding error).
>
> Well, there *is* a test, though not with StringIOWrapper, but with a
> StreamWriter from codecs, since I was not aware of StringIOWrapper. Do
> you want me to move the existing test from StreamWriter to StringIOWrapper?
> Or did you mean some test for something different altogether?
I wanted to to have a test using a 'to_file' that has to_file.encoding = None.
I thought StringIOWrapper might be the easiest way to accomplish that.
>
>> I think we should have a mention of why the try/except happens in a comment
>> next to the try/except. Something like:
>
> Sounds good, thanks.
>
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGjpcYJdeBCYSNAAMRAjhUAJ99zDu4ts5qM1AOgSaoVHM2rMb8HQCgzIgV
l7D6eVgNIVc5QjqFcz01JmQ=
=0TCA
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list