[MERGE] Uncommit doesn't throw when it encounters un-encodable characters

John Arbash Meinel john at arbash-meinel.com
Tue Dec 11 14:14:10 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Aaron Bentley wrote:
> John Arbash Meinel wrote:
> 
>> We have a helper already to 'run_bzr' with a custom encoding. If you look in
>> tests/blackbox/test_non_ascii.py:
> 
> Unfortunately, I used the log tests as my example.  Perhaps they should
> be updated if they're doing it wrong.
> 
>> Especially since Uncommit should be using "get_terminal_encoding()" which only
>> uses bzrlib.user_encoding as a fallback. So you may not actually be testing
>> that uncommit is working properly.
> 
> I did TDD.  The test failed until I changed the encoding to 'replace'.
> Ergo, I am testing the correct thing.  Since it doesn't have a terminal,
> I wouldn't think run_bzr would have a terminal encoding.
> 
> But I will try changing it to run_bzr_decode, and submit the changes if
> it works.
> 
> Aaron

The default 'run_bzr' function does take an 'encoding' parameter. But it
returns the output as raw 8-bit strings. run_bzr_decode() just decodes it for
you, so that you know you are back working with Unicode strings.

_run_bzr_core has this snippet:

        if encoding is None:
            encoding = bzrlib.user_encoding

Which is why it was working. So it was valid, but I think using
run_bzr(encoding=XXX) or run_bzr_decode(encoding=XXX) is still a better way of
doing it.

(if you do run_bzr(encoding='UTF-8') you should get back 'UTF-8' strings.

And yes, it does sound like the log tests should be updated.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHXpsyJdeBCYSNAAMRAm5wAJ900cRJXv5cOapLlVq54xoVmDw9zACgqi3V
IlQIKZ0VAKmal/hBLC5PFaA=
=fEXV
-----END PGP SIGNATURE-----



More information about the bazaar mailing list