Show More
@@ -9,6 +9,7 b' from __future__ import absolute_import' | |||
|
9 | 9 | |
|
10 | 10 | from .node import hex, nullid |
|
11 | 11 | from . import ( |
|
12 | encoding, | |
|
12 | 13 | error, |
|
13 | 14 | hbisect, |
|
14 | 15 | patch, |
@@ -257,7 +258,12 b' def showdate(repo, ctx, templ, **args):' | |||
|
257 | 258 | |
|
258 | 259 | def showdescription(repo, ctx, templ, **args): |
|
259 | 260 | """:desc: String. The text of the changeset description.""" |
|
260 |
|
|
|
261 | s = ctx.description() | |
|
262 | if isinstance(s, encoding.localstr): | |
|
263 | # try hard to preserve utf-8 bytes | |
|
264 | return encoding.tolocal(encoding.fromlocal(s).strip()) | |
|
265 | else: | |
|
266 | return s.strip() | |
|
261 | 267 | |
|
262 | 268 | def showdiffstat(repo, ctx, templ, **args): |
|
263 | 269 | """:diffstat: String. Statistics of changes with the following format: |
@@ -3556,12 +3556,14 b' Set up repository for non-ascii encoding' | |||
|
3556 | 3556 | > open('utf-8', 'w').write('\xc3\xa9') |
|
3557 | 3557 | > EOF |
|
3558 | 3558 | $ HGENCODING=utf-8 hg branch -q `cat utf-8` |
|
3559 |
$ HGENCODING=utf-8 hg ci -qAm |
|
|
3559 | $ HGENCODING=utf-8 hg ci -qAm "non-ascii branch: `cat utf-8`" utf-8 | |
|
3560 | 3560 | |
|
3561 | 3561 | json filter should try round-trip conversion to utf-8: |
|
3562 | 3562 | |
|
3563 | 3563 | $ HGENCODING=ascii hg log -T "{branch|json}\n" -r0 |
|
3564 | 3564 | "\u00e9" |
|
3565 | $ HGENCODING=ascii hg log -T "{desc|json}\n" -r0 | |
|
3566 | "non-ascii branch: \u00e9" | |
|
3565 | 3567 | |
|
3566 | 3568 | json filter takes input as utf-8b: |
|
3567 | 3569 |
General Comments 0
You need to be logged in to leave comments.
Login now