[0.8][MERGE]
Robert Collins
robertc at robertcollins.net
Sat Jun 10 09:15:15 BST 2006
The following patch fixes a severe bug in 0.8 : it will fail when given
well formed xml encoded as utf8 in the inventory. It fails because it
implicitly upcasts the serialized inventory from an ascii string when
writing it to the working tree as utf8 - in actual fact it is already
encoded as a utf8 bytestream and no conversion should be performed. Our
current xml writer happens to emit ascii-safe inventory xml, but third
party xml generators could well emit utf8, and its likely we will want
to do so ourselves in future. Accordingly I'd like to put this fix into
0.8, and an update into dapper.
https://launchpad.net/products/bzr/+bug/49224
--- bzrlib/workingtree.py 2006-06-07 15:18:15 +0000
+++ bzrlib/workingtree.py 2006-06-10 07:59:07 +0000
@@ -1218,16 +1218,17 @@
new_revision, xml)
inv.revision_id = new_revision
xml =
bzrlib.xml5.serializer_v5.write_inventory_to_string(inv)
-
+ assert isinstance(xml, str), 'serialised xml must be
bytestring.'
path = self._basis_inventory_name()
- self._control_files.put_utf8(path, xml)
+ sio = StringIO(xml)
+ self._control_files.put(path, sio)
except WeaveRevisionNotPresent:
pass
def read_basis_inventory(self):
"""Read the cached basis inventory."""
path = self._basis_inventory_name()
- return self._control_files.get_utf8(path).read()
+ return self._control_files.get(path).read()
@needs_read_lock
def read_working_inventory(self):
--
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060610/47909939/attachment.pgp
More information about the bazaar
mailing list