~ubuntu-branches/debian/sid/bzr/sid

« back to all changes in this revision

Viewing changes to debian/patches/09_utf8_config_files

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij, Jelmer Vernooij, Max Bowsher
  • Date: 2011-07-14 15:35:42 UTC
  • mfrom: (1.5.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20110714153542-7m3m8jpt6c167g2a
Tags: 2.4.0~beta5-1
[ Jelmer Vernooij ]
* Fix typo in package description. Thanks Paul Stewart.
* Mark python-bzrlib as breaking with older versions of bzr that
  predate python-bzrlib. LP: #803362

[ Max Bowsher ]
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Description: Properly load utf8-encoded config files
2
 
Origin: commit, revision id: pqm@pqm.ubuntu.com-20110620104625-ih5t1e8w288pc4l2
3
 
Author: Vincent Ladeuil <v.ladeuil+lp@free.fr>
4
 
Bug: https://launchpad.net/bugs/799212
5
 
Last-Update: 2011-06-20
6
 
Applied-Upstream: merged in revision 5988
7
 
X-Bzr-Revision-Id: pqm@pqm.ubuntu.com-20110620104625-ih5t1e8w288pc4l2
8
 
 
9
 
=== modified file 'bzrlib/config.py'
10
 
--- old/bzrlib/config.py        2011-06-19 02:48:01 +0000
11
 
+++ new/bzrlib/config.py        2011-06-20 09:31:17 +0000
12
 
@@ -2375,13 +2375,10 @@
13
 
 
14
 
         :param str_or_unicode: A string representing the file content. This will
15
 
             be utf-8 encoded internally.
16
 
-
17
 
-        This is for tests and should not be used in production unless a
18
 
-        convincing use case can be demonstrated :)
19
 
         """
20
 
         if self.is_loaded():
21
 
             raise AssertionError('Already loaded: %r' % (self._config_obj,))
22
 
-        co_input = StringIO(str_or_unicode.encode('utf-8'))
23
 
+        co_input = StringIO(str_or_unicode)
24
 
         try:
25
 
             # The config files are always stored utf8-encoded
26
 
             self._config_obj = ConfigObj(co_input, encoding='utf-8')
27
 
 
28
 
=== modified file 'bzrlib/tests/test_config.py'
29
 
--- old/bzrlib/tests/test_config.py     2011-06-14 10:07:16 +0000
30
 
+++ new/bzrlib/tests/test_config.py     2011-06-20 09:31:17 +0000
31
 
@@ -2328,6 +2328,22 @@
32
 
         self.assertRaises(AssertionError, store._load_from_string, 'bar=baz')
33
 
 
34
 
 
35
 
+class TestBug799212(TestStore):
36
 
+
37
 
+   def test_load_utf8(self):
38
 
+        t = self.get_transport()
39
 
+        # From http://pad.lv/799212
40
 
+        unicode_user = u'Piotr O\u017carowski'
41
 
+        unicode_content = u'user=%s' % (unicode_user,)
42
 
+        utf8_content = unicode_content.encode('utf8')
43
 
+        # Store the raw content in the config file
44
 
+        t.put_bytes('foo.conf', utf8_content)
45
 
+        store = config.IniFileStore(t, 'foo.conf')
46
 
+        store.load()
47
 
+        stack = config.Stack([store.get_sections], store)
48
 
+        self.assertEquals(unicode_user, stack.get('user'))
49
 
+
50
 
+
51
 
 class TestMutableStore(TestStore):
52
 
 
53
 
     scenarios = [(key, {'store_id': key, 'get_store': builder}) for key, builder
54
 
 
55
 
=== modified file 'doc/en/release-notes/bzr-2.4.txt'
56
 
--- old/doc/en/release-notes/bzr-2.4.txt        2011-06-18 13:57:17 +0000
57
 
+++ new/doc/en/release-notes/bzr-2.4.txt        2011-06-20 09:31:17 +0000
58
 
@@ -29,6 +29,8 @@
59
 
 Bug Fixes
60
 
 *********
61
 
 
62
 
+* Properly load utf8-encoded config files. (Vincent Ladeuil, #799212)
63
 
+
64
 
 .. Fixes for situations where bzr would previously crash or give incorrect
65
 
    or undesirable results.
66
 
 
67