Show More
@@ -76,7 +76,6 b' from mercurial import (' | |||||
76 | archival, |
|
76 | archival, | |
77 | cmdutil, |
|
77 | cmdutil, | |
78 | commands, |
|
78 | commands, | |
79 | encoding, |
|
|||
80 | error, |
|
79 | error, | |
81 | filemerge, |
|
80 | filemerge, | |
82 | scmutil, |
|
81 | scmutil, | |
@@ -365,7 +364,10 b' def uisetup(ui):' | |||||
365 | if options: |
|
364 | if options: | |
366 | options = ' ' + options |
|
365 | options = ' ' + options | |
367 | return dodiff(ui, repo, cmdline + options, pats, opts) |
|
366 | return dodiff(ui, repo, cmdline + options, pats, opts) | |
368 | doc = _('''\ |
|
367 | # We can't pass non-ASCII through docstrings (and path is | |
|
368 | # in an unknown encoding anyway) | |||
|
369 | docpath = path.encode("string-escape") | |||
|
370 | mydiff.__doc__ = '''\ | |||
369 | use %(path)s to diff repository (or selected files) |
|
371 | use %(path)s to diff repository (or selected files) | |
370 |
|
372 | |||
371 | Show differences between revisions for the specified files, using |
|
373 | Show differences between revisions for the specified files, using | |
@@ -376,15 +378,7 b' use %(path)s to diff repository (or sele' | |||||
376 | that revision is compared to the working directory, and, when no |
|
378 | that revision is compared to the working directory, and, when no | |
377 | revisions are specified, the working directory files are compared |
|
379 | revisions are specified, the working directory files are compared | |
378 | to its parent.\ |
|
380 | to its parent.\ | |
379 |
''' |
|
381 | ''' % {'path': util.uirepr(docpath)} | |
380 |
|
||||
381 | # We must translate the docstring right away since it is |
|
|||
382 | # used as a format string. The string will unfortunately |
|
|||
383 | # be translated again in commands.helpcmd and this will |
|
|||
384 | # fail when the docstring contains non-ASCII characters. |
|
|||
385 | # Decoding the string to a Unicode string here (using the |
|
|||
386 | # right encoding) prevents that. |
|
|||
387 | mydiff.__doc__ = doc.decode(encoding.encoding) |
|
|||
388 | return mydiff |
|
382 | return mydiff | |
389 | command(cmd, extdiffopts[:], _('hg %s [OPTION]... [FILE]...') % cmd, |
|
383 | command(cmd, extdiffopts[:], _('hg %s [OPTION]... [FILE]...') % cmd, | |
390 | inferrepo=True)(save(cmdline)) |
|
384 | inferrepo=True)(save(cmdline)) |
@@ -389,3 +389,23 b' Test symlinks handling (issue1909)' | |||||
389 | $ cd .. |
|
389 | $ cd .. | |
390 |
|
390 | |||
391 | #endif |
|
391 | #endif | |
|
392 | ||||
|
393 | Test handling of non-ASCII paths in generated docstrings (issue5301) | |||
|
394 | ||||
|
395 | >>> open("u", "w").write("\xa5\xa5") | |||
|
396 | $ U=`cat u` | |||
|
397 | ||||
|
398 | $ HGPLAIN=1 hg --config hgext.extdiff= --config extdiff.cmd.td=hi help -k xyzzy | |||
|
399 | abort: no matches | |||
|
400 | (try "hg help" for a list of topics) | |||
|
401 | [255] | |||
|
402 | ||||
|
403 | $ HGPLAIN=1 hg --config hgext.extdiff= --config extdiff.cmd.td=hi help td > /dev/null | |||
|
404 | ||||
|
405 | $ LC_MESSAGES=ja_JP.UTF-8 hg --config hgext.extdiff= --config extdiff.cmd.td=$U help -k xyzzy | |||
|
406 | abort: no matches | |||
|
407 | (try "hg help" for a list of topics) | |||
|
408 | [255] | |||
|
409 | ||||
|
410 | $ LC_MESSAGES=ja_JP.UTF-8 hg --config hgext.extdiff= --config extdiff.cmd.td=$U help td | grep "^use" | |||
|
411 | use '\xa5\xa5' to diff repository (or selected files) |
General Comments 0
You need to be logged in to leave comments.
Login now