3 $ HGENCODING=utf-8 |
3 $ HGENCODING=utf-8 |
4 $ export HGENCODING |
4 $ export HGENCODING |
5 $ hg init t |
5 $ hg init t |
6 $ cd t |
6 $ cd t |
7 $ "$PYTHON" << EOF |
7 $ "$PYTHON" << EOF |
|
8 > from mercurial import pycompat |
8 > # (byte, width) = (6, 4) |
9 > # (byte, width) = (6, 4) |
9 > s = b"\xe7\x9f\xad\xe5\x90\x8d" |
10 > s = b"\xe7\x9f\xad\xe5\x90\x8d" |
10 > # (byte, width) = (7, 7): odd width is good for alignment test |
11 > # (byte, width) = (7, 7): odd width is good for alignment test |
11 > m = b"MIDDLE_" |
12 > m = b"MIDDLE_" |
12 > # (byte, width) = (18, 12) |
13 > # (byte, width) = (18, 12) |
19 > from mercurial import registrar |
20 > from mercurial import registrar |
20 > cmdtable = {} |
21 > cmdtable = {} |
21 > command = registrar.command(cmdtable) |
22 > command = registrar.command(cmdtable) |
22 > |
23 > |
23 > @command(b'showoptlist', |
24 > @command(b'showoptlist', |
24 > [('s', 'opt1', '', 'short width' + ' %(s)s' * 8, '%(s)s'), |
25 > [(b's', b'opt1', b'', b'short width' + (b' ' +%(s)s) * 8, %(s)s), |
25 > ('m', 'opt2', '', 'middle width' + ' %(m)s' * 8, '%(m)s'), |
26 > (b'm', b'opt2', b'', b'middle width' + (b' ' + %(m)s) * 8, %(m)s), |
26 > ('l', 'opt3', '', 'long width' + ' %(l)s' * 8, '%(l)s')], |
27 > (b'l', b'opt3', b'', b'long width' + (b' ' + %(l)s) * 8, %(l)s)], |
27 > '') |
28 > b'') |
28 > def showoptlist(ui, repo, *pats, **opts): |
29 > def showoptlist(ui, repo, *pats, **opts): |
29 > '''dummy command to show option descriptions''' |
30 > '''dummy command to show option descriptions''' |
30 > return 0 |
31 > return 0 |
31 > """ % globals()) |
32 > """ % {b's': pycompat.byterepr(s), |
|
33 > b'm': pycompat.byterepr(m), |
|
34 > b'l': pycompat.byterepr(l), |
|
35 > }) |
32 > f.close() |
36 > f.close() |
33 > EOF |
37 > EOF |
34 $ S=`cat s` |
38 $ S=`cat s` |
35 $ M=`cat m` |
39 $ M=`cat m` |
36 $ L=`cat l` |
40 $ L=`cat l` |