Commit cf55b285 authored by Georges Racinet's avatar Georges Racinet 🦑

hooks.dev_util: removing HEPTAPOD_HG_NATIVE from output

(this is used to test the presence of environment variables,
notably for user hooks).

The result would be inconsistent between SSH and HTTP access.
Another solution would be to add the variable to the HTTP case
(forwarding in WSGI wrapper), but that's an implementation detail
for real consumers, so we did not.
parent b4a6ffb16f81
Pipeline #12939 passed with stages
in 2 minutes
......@@ -8,11 +8,17 @@ from mercurial import pycompat
def print_heptapod_env(repo, *args, **kwargs):
# this environment variable is present on invocation from Heptapod Shell
# but is not forwarded in the WSGI wrapper (and shouldn't).
# Removing it for consistency
to_print = dict(repo.ui.environ)
to_print.pop(b'HEPTAPOD_HG_NATIVE', None)
# repr() does the job for us to format the list
# sysstr decodes from latin-1 (no failures), and we need to reencode
# for ui.status
repo.ui.status(repr(sorted(
(pycompat.sysstr(k), pycompat.sysstr(v))
for (k, v) in repo.ui.environ.items()
for (k, v) in to_print.items()
if k.startswith(b'HEPTAPOD_'))).encode('latin-1'))
return 0
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