Merge lp:~krause/bzr/1037108 into lp:bzr
Status: | Rejected |
---|---|
Rejected by: | Richard Wilbur |
Proposed branch: | lp:~krause/bzr/1037108 |
Merge into: | lp:bzr |
Diff against target: |
15 lines (+2/-2) 1 file modified
bzrlib/log.py (+2/-2) |
To merge this branch: | bzr merge lp:~krause/bzr/1037108 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Richard Wilbur | branch superceded | Disapprove | |
John A Meinel | Needs Fixing | ||
Review via email: mp+119912@code.launchpad.net |
Description of the change
When accessing a repository which has signed commits and where the name of the author contains non ASCII characters you will get an UnicodeEncodeError when trying to get the log if signature display is enabled.
E.g. you can try
bzr log --signatures lp:~pixeldrama/annis/restr_vis -r 973..975
The problem is in bzrlib/log.py in the function "format_
This branch fixes this for this specific function by using unicode string constants (u"abc").
Please note that I was not able to add a testcase since neither all other testcases were successfull on my computer nor did I find a good place to put the testcase.
Unmerged revisions
- 6554. By Thomas Krause
-
use unicode constants
Since this is an issue for 'log', I think either bzrlib/ tests/test_ log.py or bzrlib/ tests/blackbox/ test_log. py would be good places. (I prefer the former as a white-box test, vs the later as a whole-command test.)
All of those tests should pass on all platforms, and you can just run those tests with:
bzr selftest -s bt.test_log -s bb.test_log
The change itself seems ok, but maybe incomplete. It seems that the real problem is that we are not decoding result[1]. So it comes in as a UTF-8 string (8-bit str with high bits set.) When what we need is a python Unicode string. It is also good to have the format strings be unicode.
So a fix like:
unicode_result = result[ 1].decode( 'utf-8' ) # Can we assume utf8? VALID: unicode_ result)
if result[0] == gpg.SIGNATURE_
return u'valid signature from {0}'.format(
...
etc.