[MERGE][0.16] Fix Bundle handling of empty properties
John Arbash Meinel
john at arbash-meinel.com
Wed Apr 25 19:01:18 BST 2007
The current bundle code improperly reads empty revision properties. It
has code that does:
loc = value.find(': ')
assert loc is not None # This should be loc != -1
key = value[:loc]
value = value[loc+2:]
However, the code that writes properties has:
if not value:
write(key + ':\n')
else:
write(key + ': ' + value + '\n')
This means that bzr (for a long time now) isn't able to read bundles
that have a property with no value.
The attached patch does a few things:
1) Fixes the reader so that it can handle "key:\n" properly.
2) Fixes the writer to generate "key: \n" since that will work with
older bzr versions.
3) Writes out properties in sorted order, like the xml Revision
serializer does. This is completely compatible, and just makes direct
testing easier.
4) While there I found other bugs with how we handle unicode values, so
I fixed that too.
I'm still not positive about (2). It seems an "unclean" fix. Especially
considering that older clients can't handle their own bundles, it seems
better to just fix the reader, and avoid creating properties with no
values for now.
It is easy enough to update the tests and revert the functionality back
if we decide not to do (2).
John
=:->
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bundle_empty_properties.patch
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20070425/039bfeb1/attachment-0001.diff
More information about the bazaar
mailing list