[MERGE] Make annotate behave in a non-ASCII world (v1)

Adeodato Simó dato at net.com.org.es
Fri Jul 6 20:12:54 BST 2007


* 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

> 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 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.

-- 
Adeodato Simó                                     dato at net.com.org.es
Debian Developer                                  adeodato at debian.org
 
Que no te vendan amor sin espinas
                -- Joaquín Sabina, Noches de boda




More information about the bazaar mailing list