version-info --include-history UnicodeDecodeError (518609)

Parth Malwankar parth.malwankar at gmail.com
Fri Apr 2 22:36:39 BST 2010


Hello,

I was looking at bug #518609[1] and tracked the offending line to
format_rio.RioVersionInfoBuilder.generate.
    log.add('message', message)

I noticed that message is unicode and based on irc chat with lifeless
I understand that message should not be unicode. Sure enough, the
patch below fixes the issue.

=== modified file 'bzrlib/version_info_formats/format_rio.py'
--- bzrlib/version_info_formats/format_rio.py	2010-02-17 17:11:16 +0000
+++ bzrlib/version_info_formats/format_rio.py	2010-04-02 21:26:16 +0000
@@ -65,7 +65,7 @@
             for (revision_id, message,
                  timestamp, timezone) in self._revision_history_info:
                 log.add('id', revision_id)
-                log.add('message', message)
+                log.add('message', message.encode('ascii', 'ignore'))
                 log.add('date', create_date_str(timestamp, timezone))
             info.add('revisions', log.to_unicode())

I have a questions regarding this.
- Does bzr store messages as ascii?
- Is this the right place to convert message to ascii or shoud I try to
find out why message is unicode in the first place?
- It this fix appropriate? Any other ideas?

Regards,
Parth

[1] https://bugs.launchpad.net/bzr/+bug/518609



More information about the bazaar mailing list