[RFC] Solution for Bug 135320 UnicodeDecodeError

Müller-Reineke, Matthias matthias.mueller-reineke at grundvers.de
Mon Feb 11 11:49:32 GMT 2008


Hi,

a german umlaut in a file name makes it impossibble to merge two branches with bzr 1.1 (see Bug 135320). This seems to solve the problem:

=== modified file 'bzrlib/dirstate.py'
--- bzrlib/dirstate.py	2007-12-19 08:12:34 +0000
+++ bzrlib/dirstate.py	2008-02-11 10:41:12 +0000
@@ -1839,7 +1839,7 @@
         """
         output_lines = [DirState.HEADER_FORMAT_3]
         lines.append('') # a final newline
-        inventory_text = '\0\n\0'.join(lines)
+        inventory_text = '\0\n\0'.join(map(osutils.safe_utf8, lines))
         output_lines.append('crc32: %s\n' % (zlib.crc32(inventory_text),))
         # -3, 1 for num parents, 1 for ghosts, 1 for final newline
         num_entries = len(lines)-3

What do you think about it?
Unfortunately I didn't understand the purpose of DirState exactly so I don't know how to create a correct module test for my bug and it's solution.


Matthias Müller-Reineke

------------------------------------------
Grundeigentümer-Versicherung VVaG
Große Bäckerstraße 7
20095 Hamburg
Tel: 040 - 3 76 63 - 199
Fax: 040 - 3 76 63 - 98 199

http://www.grundvers.de
<mailto:matthias.mueller-reineke at grundvers.de>

Firmensitz: Hamburg HRB 13 103
Vorstand: Heinz Walter Berens (Vors.), Rüdiger Buyten
Aufsichtsratsvorsitzender: Peter Landmann
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 135320-UnicodeDecodeError.patch
Type: application/octet-stream
Size: 2271 bytes
Desc: 135320-UnicodeDecodeError.patch
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080211/ff4f5a3b/attachment.obj 


More information about the bazaar mailing list