Read about our upcoming Code of Conduct on this issue

Commit 32630356 authored by Matt Harbison's avatar Matt Harbison
Browse files

Byteify registered command help and the `buglink` attribute

I hit this in various test-check-* tests for Mercurial when running on a zstd
repo without the C extensions, but this can be trivially reproduced with
`HGPLAIN=1`:

    *** failed to import extension mercurial_keyring: unicode 'keyring_check [PATH]' found in cmdtable.keyring_check
    *** (use b'' to make it byte string)

The issue is that `i18n._()` wants bytes, but leaves a backdoor for `str` for
docstrings.  That backdoor is closed if `HGPLAIN` or `HGPLAINEXCEPT` is set
(unless `i18n` is set in `HGPLAINEXCEPT`).  There are a bunch of other uses of
this function that still need to be byteified.

The global `buglink`, `testedwith`, and `minimumhgversion` also want to be
bytes.
parent 7f97b1e4d0a8
......@@ -794,7 +794,7 @@ command = meu.command(cmdtable)
@command(b'keyring_check',
[],
_("keyring_check [PATH]"),
_(b"keyring_check [PATH]"),
optionalrepo=True)
def cmd_keyring_check(ui, repo, *path_args, **opts): # pylint: disable=unused-argument
"""
......@@ -848,7 +848,7 @@ def cmd_keyring_check(ui, repo, *path_args, **opts): # pylint: disable=unused-
@command(b'keyring_clear',
[],
_('hg keyring_clear PATH-OR-ALIAS'),
_(b'hg keyring_clear PATH-OR-ALIAS'),
optionalrepo=True)
def cmd_keyring_clear(ui, repo, path, **opts): # pylint: disable=unused-argument
"""
......@@ -890,4 +890,4 @@ def cmd_keyring_clear(ui, repo, path, **opts): # pylint: disable=unused-argumen
user, final_url))
buglink = 'https://foss.heptapod.net/mercurial/mercurial_keyring/issues'
buglink = b'https://foss.heptapod.net/mercurial/mercurial_keyring/issues'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment