[MERGE] Fix Tree.get_symlink_target to decode from the disk encoding to get a unicode encoded string.

John Arbash Meinel john at arbash-meinel.com
Tue Mar 31 02:58:29 BST 2009


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

Robert Collins wrote:
> This should fix the problem with record_iter_changes on unicode
> platforms.
> 
> Note that it changes the output of 'diff' on a symlink because of how we
> output the link; we could change this.
> 
> -Rob
> 

BB:tweak

I'm okay with this, but it might be nice if we used some temporary
variables to help resolve all of the .encode() and .decode bits being
called.

abs_unicode_path = self.id2abspath(file_id)
# There is a bug in older versions of python, they don't automatically
# encode the path supplied back into fs encoding
abs_fs_path = abs_unicode_path.encode(osutils._fs_enc)
# readlink also always returns fs paths
target_fs_path = os.readlink(abs_fs_path)
return target_fs_path.decode(osutils._fs_enc)

Maybe not, but I find the chain pretty hard to understand.

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAknReMUACgkQJdeBCYSNAAMBCwCg2TBYLzZz/wwQCOtbP8B4h9J7
Js4AoIic+a5IlkbufJ/Fk8oVupkR+qt4
=9aWw
-----END PGP SIGNATURE-----



More information about the bazaar mailing list