Skip to content
Snippets Groups Projects
Commit b910be77 authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

hooks: add a `auto` value for `hooks.*run-with-plain`

That setting restore the behavior pre-5.6. The current HGPLAIN value is simply
passed to the hooks.

This allow user who needs it to fully mitigate the behavior change introduced
in Mercurial 5.7 by restoring the older behavior.

Differential Revision: https://phab.mercurial-scm.org/D9982
parent 7289eac7
No related branches found
No related tags found
No related merge requests found
......@@ -1032,6 +1032,8 @@
incoming.autobuild:run-with-plain = yes
# HGPLAIN never set
incoming.autobuild:run-with-plain = no
# HGPLAIN inherited from environment (default before Mercurila 5.7)
incoming.autobuild:run-with-plain = auto
Most hooks are run with environment variables set that give useful
additional information. For each hook below, the environment variables
......
......@@ -158,7 +158,10 @@
env[b'HG_HOOKTYPE'] = htype
env[b'HG_HOOKNAME'] = name
plain = ui.configbool(b'hooks', b'%s:run-with-plain' % name)
if ui.config(b'hooks', b'%s:run-with-plain' % name) == b'auto':
plain = ui.plain()
else:
plain = ui.configbool(b'hooks', b'%s:run-with-plain' % name)
if plain:
env[b'HGPLAIN'] = b'1'
else:
......
......@@ -1412,9 +1412,11 @@
> pre-version.testing-yes:run-with-plain=yes
> pre-version.testing-no=echo '### no ########' plain: \${HGPLAIN:-'<unset>'}
> pre-version.testing-no:run-with-plain=no
> pre-version.testing-auto=echo '### auto ######' plain: \${HGPLAIN:-'<unset>'}
> pre-version.testing-auto:run-with-plain=auto
> EOF
$ (unset HGPLAIN; hg version --quiet)
### default ### plain: 1
### yes ####### plain: 1
### no ######## plain: <unset>
......@@ -1415,12 +1417,13 @@
> EOF
$ (unset HGPLAIN; hg version --quiet)
### default ### plain: 1
### yes ####### plain: 1
### no ######## plain: <unset>
### auto ###### plain: <unset>
Mercurial Distributed SCM (*) (glob)
$ HGPLAIN=1 hg version --quiet
### default ### plain: 1
### yes ####### plain: 1
### no ######## plain: <unset>
......@@ -1421,7 +1424,8 @@
Mercurial Distributed SCM (*) (glob)
$ HGPLAIN=1 hg version --quiet
### default ### plain: 1
### yes ####### plain: 1
### no ######## plain: <unset>
### auto ###### plain: 1
Mercurial Distributed SCM (*) (glob)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment