[Commented On] D9982: hooks: add a `auto` value for `hooks.*run-with-plain`
baymax (Baymax, Your Personal Patch-care Companion)
phabricator at mercurial-scm.org
Thu Feb 11 10:26:05 UTC 2021
baymax added a comment.
baymax updated this revision to Diff 25546.
✅ refresh by Heptapod after a successful CI run (🐙 💚)
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D9982?vs=25544&id=25546
BRANCH
stable
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D9982/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D9982
AFFECTED FILES
mercurial/helptext/config.txt
mercurial/hook.py
tests/test-hook.t
CHANGE DETAILS
diff --git a/tests/test-hook.t b/tests/test-hook.t
--- a/tests/test-hook.t
+++ b/tests/test-hook.t
@@ -1412,16 +1412,20 @@
> 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>
+ ### auto ###### plain: <unset>
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)
diff --git a/mercurial/hook.py b/mercurial/hook.py
--- a/mercurial/hook.py
+++ b/mercurial/hook.py
@@ -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:
diff --git a/mercurial/helptext/config.txt b/mercurial/helptext/config.txt
--- a/mercurial/helptext/config.txt
+++ b/mercurial/helptext/config.txt
@@ -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
To: marmoute, #hg-reviewers
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210211/774728d5/attachment-0002.html>
More information about the Mercurial-patches
mailing list