[MERGE] Uncommit doesn't throw when it encounters un-encodable characters
John Arbash Meinel
john at arbash-meinel.com
Tue Dec 11 13:31:59 GMT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Aaron Bentley wrote:
> Hi all,
>
> This patch fixes uncommit so that it can succeed even if not all the
> characters in the commit messages can be displayed. Previously, it
> would raise a UnicodeEncode error.
>
> Aaron
We have a helper already to 'run_bzr' with a custom encoding. If you look in
tests/blackbox/test_non_ascii.py:
def test_status(self):
self.build_tree_contents(
[(self.info['filename'], 'changed something\n')])
txt = self.run_bzr_decode('status')
self.assertEqual(u'modified:\n %s\n' % (self.info['filename'],), txt)
txt = self.run_bzr_decode('status', encoding='ascii')
expected = u'modified:\n %s\n' % (
self.info['filename'].encode('ascii', 'replace'),)
self.assertEqual(expected, txt)
"run_bzr_decode(..., encoding=XXX)"
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. (We do that because on Windows,
terminal_encoding != locale.getpreferredencoding [aka user_encoding] !=
sys.getfilesystemencoding [mbcs].
BB:tweak
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHXpFOJdeBCYSNAAMRAvtRAJ0V723oFWjWf6DTT6f8EfArC/MbtwCgwHCQ
QNyQGZ6H7NRaSGuADpPVbs4=
=kMsk
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list