Rev 4247: Fix bug #355454 by casting to unicode. in file:///net/bigmamac/Volumes/home/vila/src/bzr/bugs/355454-unicode-warning/

Vincent Ladeuil v.ladeuil+lp at free.fr
Tue Apr 7 16:27:24 BST 2009


At file:///net/bigmamac/Volumes/home/vila/src/bzr/bugs/355454-unicode-warning/

------------------------------------------------------------
revno: 4247
revision-id: v.ladeuil+lp at free.fr-20090407152722-sjqm8i2nx4byab2p
parent: pqm at pqm.ubuntu.com-20090406235830-isrefclw112zgeem
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 355454-unicode-warning
timestamp: Tue 2009-04-07 17:27:22 +0200
message:
  Fix bug #355454 by casting to unicode.
  
  * bzrlib/workingtree_4.py:
  (ContentFilterAwareSHA1Provider.sha1,
  ContentFilterAwareSHA1Provider.stat_and_sha1): We may be called
  with utf8 paths, yet, we need to provide unicode ones to
  tree.relpath.
-------------- next part --------------
=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2009-03-31 14:13:27 +0000
+++ b/bzrlib/workingtree_4.py	2009-04-07 15:27:22 +0000
@@ -1302,12 +1302,14 @@
 
     def sha1(self, abspath):
         """Return the sha1 of a file given its absolute path."""
-        filters = self.tree._content_filter_stack(self.tree.relpath(abspath))
+        filters = self.tree._content_filter_stack(
+            self.tree.relpath(osutils.safe_unicode(abspath)))
         return internal_size_sha_file_byname(abspath, filters)[1]
 
     def stat_and_sha1(self, abspath):
         """Return the stat and sha1 of a file given its absolute path."""
-        filters = self.tree._content_filter_stack(self.tree.relpath(abspath))
+        filters = self.tree._content_filter_stack(
+            self.tree.relpath(osutils.safe_unicode(abspath)))
         file_obj = file(abspath, 'rb', 65000)
         try:
             statvalue = os.fstat(file_obj.fileno())



More information about the bazaar-commits mailing list