Mercurial > public > mercurial-scm > hg-stable
diff tests/test-extdiff.t @ 29630:67b180c0e263 stable
extdiff: escape path for docstring (issue5301)
The existing code (a) assumed path would be specified in
encoding.encoding and (b) assumed unicode() objects wouldn't cause
other parts of Mercurial to blow up. Both are dangerous assumptions.
Since we don't know the encoding of path and can't pass non-ASCII
through docstrings, just escape the path and drop the early _(). Will
have to suffice until we can teach docstrings to handle UTF-8b
escaping.
This has the side-effect that the line containing the path is now
variable by the time it reaches _() and thus can't be translated.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 18 Jul 2016 16:25:35 -0500 |
parents | 34a2944aac9b |
children | 91b2f2176395 |
line wrap: on
line diff
--- a/tests/test-extdiff.t Thu Jul 21 15:55:47 2016 -0700 +++ b/tests/test-extdiff.t Mon Jul 18 16:25:35 2016 -0500 @@ -389,3 +389,23 @@ $ cd .. #endif + +Test handling of non-ASCII paths in generated docstrings (issue5301) + + >>> open("u", "w").write("\xa5\xa5") + $ U=`cat u` + + $ HGPLAIN=1 hg --config hgext.extdiff= --config extdiff.cmd.td=hi help -k xyzzy + abort: no matches + (try "hg help" for a list of topics) + [255] + + $ HGPLAIN=1 hg --config hgext.extdiff= --config extdiff.cmd.td=hi help td > /dev/null + + $ LC_MESSAGES=ja_JP.UTF-8 hg --config hgext.extdiff= --config extdiff.cmd.td=$U help -k xyzzy + abort: no matches + (try "hg help" for a list of topics) + [255] + + $ LC_MESSAGES=ja_JP.UTF-8 hg --config hgext.extdiff= --config extdiff.cmd.td=$U help td | grep "^use" + use '\xa5\xa5' to diff repository (or selected files)