Mercurial > hg
comparison hgext/show.py @ 31820:45761ef1bc93
py3: have registrar process docstrings in bytes
Mixing bytes and unicode creates a mess. Do things in bytes as possible.
New sysbytes() helper only takes care of ASCII characters, but avoids raising
nasty unicode exception. This is the same design principle as sysstr().
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 05 Apr 2017 00:34:58 +0900 |
parents | 264baeef3588 |
children | ad366d57d574 |
comparison
equal
deleted
inserted
replaced
31819:95a67508fd72 | 31820:45761ef1bc93 |
---|---|
17 from mercurial.i18n import _ | 17 from mercurial.i18n import _ |
18 from mercurial import ( | 18 from mercurial import ( |
19 cmdutil, | 19 cmdutil, |
20 commands, | 20 commands, |
21 error, | 21 error, |
22 pycompat, | |
22 registrar, | 23 registrar, |
23 ) | 24 ) |
24 | 25 |
25 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | 26 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
26 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | 27 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
131 # into core or when another extension wants to provide a view, we'll need | 132 # into core or when another extension wants to provide a view, we'll need |
132 # to do this more robustly. | 133 # to do this more robustly. |
133 # TODO make this more robust. | 134 # TODO make this more robust. |
134 longest = max(map(len, showview._table.keys())) | 135 longest = max(map(len, showview._table.keys())) |
135 for key in sorted(showview._table.keys()): | 136 for key in sorted(showview._table.keys()): |
136 cmdtable['show'][0].__doc__ += ' %s %s\n' % ( | 137 cmdtable['show'][0].__doc__ += pycompat.sysstr(' %s %s\n' % ( |
137 key.ljust(longest), showview._table[key]._origdoc) | 138 key.ljust(longest), showview._table[key]._origdoc)) |