[BUG] plugin 'version-info' prints out summary information for a branch

John A Meinel john at arbash-meinel.com
Thu Dec 29 16:43:47 GMT 2005


Alexander Belchenko wrote:
> John Arbash Meinel пишет:
>> So I created a plugin, which can be found at:
>> http://bzr.arbash-meinel.com/plugins/version_info/
>>
>> This adds a new command 'bzr version-info' which can generate either rio
>> style information, or python text which contains a dictionary of
>> information.
> 
> I try this plugin and have persistent error when running inside any
> branch (with command `bzr version-info`).
> 
> bzr: ERROR: exceptions.UnicodeDecodeError: 'ascii' codec can't decode
> byte 0xc3 in position 56: ordinal not in range(128)
>   at C:\Python24\lib\codecs.py line 186
>   in writelines
> 
> When I run command in debugger I see that in method rio.py:
> Stanza.to_lines() when you go:
> 
> for tag, value in self.items:
> 
> then when tag is 'date' then value on my russian win32 is
> '2005-12-29 08:14:33 (Thursday, December 29, 2005,
> \xc3\xf0\xe5\xf6\xe8\xff, \xd2\xf3\xf0\xf6\xe8\xff (\xe7\xe8\xec\xe0))'
> 
> or in string form is:
> 
> 2005-12-29 08:14:33 (Thursday, December 29, 2005, Греция, Турция (зима))
> 
> that equivalent to english form:
> 
> 2005-12-29 08:14:33 (Thursday, December 29, 2005, Greece, Turkey (winter))
> 
> I.e. obtained long date form contain description of current time zone in
> default (russian) language.
> 
> I think simple fix for this is decoding flat string with
> bzrlib.user_encoding.
> 
> When I run with flag --format=python I don't have any encodings errors
> but output looks like a mix of flat strings and unicode strings:
> 
> version_info ={'branch_nick':
> u'E:\\work\\Python\\bzr\\plugins\\zip-exporter',
>  'clean': None,
>  'date': '2005-12-29 08:31:45 (Thursday, December 29, 2005,
> \xc3\xf0\xe5\xf6\xe8\xff, \xd2\xf3\xf0\xf6\xe8\xff (\xe7\xe8\xec\xe0))',
>  'revision_id': u'bialix at ukr.net-20051114211523-e15049ea116cc221',
>  'revisions': None,
>  'revno': 9}
> 
> 
> I think it's not good because information of string encoding is lost.
> 
> -- 
> Alexander
> 

Thanks for the encoding warning. I think it is just an issue with
time.strftime(), can you try changing the two lines:
time.strftime('%Y-%m-%d %H:%M:%S (%A, %B %d, %Y, %Z)')
to
time.strftime(u'%Y-%m-%d %H:%M:%S (%A, %B %d, %Y, %Z)')

Though honestly, the extra stuff is just fluff. We would do just fine if
we did:
time.strftime(u'%Y-%m-%d %H:%M:%S')

Though I also can't say that I expected it to turn
%Z  	Time zone name (no characters if no time zone exists).

Into 'Greece, Turkey (winter)'. I expected more like CST

Anyway, I'm fine with using the reduced form, I would have liked to have
a time zone in it. But it seems python doesn't create ASCII time zone names.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051229/4623bba5/attachment.pgp 


More information about the bazaar mailing list