Merge lp:~jelmer/brz/non-utf8-locale into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/non-utf8-locale
Merge into: lp:brz
Diff against target: 40 lines (+4/-5)
2 files modified
breezy/bzr/workingtree_3.py (+3/-1)
breezy/tests/per_workingtree/test_readonly.py (+1/-4)
To merge this branch: bzr merge lp:~jelmer/brz/non-utf8-locale
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+360088@code.launchpad.net

Commit message

Prevent UnicodeDecodeError on Python 2 with LANG=fr_FR.ISO-8859-1.

Description of the change

Prevent UnicodeDecodeError on Python 2 with LANG=fr_FR.ISO-8859-1.

Without this change the following tests break on Python 2:

breezy.tests.per_workingtree.test_readonly.TestReadonly.test_readonly_unclean(WorkingTreeFormat3)
breezy.tests.per_workingtree.test_readonly.TestReadonly.test_readonly_unclean(WorkingTreeFormat2)

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

As per other uses of safe_unicode this is technically wrong but requires some smarts in trace that doesn't exist yet. So, is probably fine to land pending work to make it redundant.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'breezy/bzr/workingtree_3.py'
--- breezy/bzr/workingtree_3.py 2018-11-16 18:35:30 +0000
+++ breezy/bzr/workingtree_3.py 2018-12-04 19:58:21 +0000
@@ -30,6 +30,7 @@
30from .. import (30from .. import (
31 errors,31 errors,
32 hashcache,32 hashcache,
33 osutils,
33 revision as _mod_revision,34 revision as _mod_revision,
34 trace,35 trace,
35 transform,36 transform,
@@ -80,7 +81,8 @@
80 # warning might be sufficient to let the user know what81 # warning might be sufficient to let the user know what
81 # is going on.82 # is going on.
82 trace.mutter('Could not write hashcache for %s\nError: %s',83 trace.mutter('Could not write hashcache for %s\nError: %s',
83 self._hashcache.cache_file_name(), e)84 self._hashcache.cache_file_name(),
85 osutils.safe_unicode(e.args[1]))
8486
85 def get_file_sha1(self, path, stat_value=None):87 def get_file_sha1(self, path, stat_value=None):
86 with self.lock_read():88 with self.lock_read():
8789
=== modified file 'breezy/tests/per_workingtree/test_readonly.py'
--- breezy/tests/per_workingtree/test_readonly.py 2018-07-02 00:58:07 +0000
+++ breezy/tests/per_workingtree/test_readonly.py 2018-12-04 19:58:21 +0000
@@ -104,13 +104,10 @@
104 # Make it readonly, and do some operations and then unlock104 # Make it readonly, and do some operations and then unlock
105 self.set_dirs_readonly('tree')105 self.set_dirs_readonly('tree')
106106
107 tree.lock_read()107 with tree.lock_read():
108 try:
109 if hack_dirstate:108 if hack_dirstate:
110 tree._dirstate._cutoff_time = self._custom_cutoff_time()109 tree._dirstate._cutoff_time = self._custom_cutoff_time()
111 # Make sure we check all the files110 # Make sure we check all the files
112 for path in tree.all_versioned_paths():111 for path in tree.all_versioned_paths():
113 size = tree.get_file_size(path)112 size = tree.get_file_size(path)
114 sha1 = tree.get_file_sha1(path)113 sha1 = tree.get_file_sha1(path)
115 finally:
116 tree.unlock()

Subscribers

People subscribed via source and target branches