##// END OF EJS Templates
hooks: add a `auto` value for `hooks.*run-with-plain`...
marmoute -
r47222:8872e75e default draft
parent child Browse files
Show More
@@ -1032,6 +1032,8 b' Example ``.hg/hgrc``::'
1032 1032 incoming.autobuild:run-with-plain = yes
1033 1033 # HGPLAIN never set
1034 1034 incoming.autobuild:run-with-plain = no
1035 # HGPLAIN inherited from environment (default before Mercurila 5.7)
1036 incoming.autobuild:run-with-plain = auto
1035 1037
1036 1038 Most hooks are run with environment variables set that give useful
1037 1039 additional information. For each hook below, the environment variables
@@ -158,7 +158,10 b' def _exthook(ui, repo, htype, name, cmd,'
158 158 env[b'HG_HOOKTYPE'] = htype
159 159 env[b'HG_HOOKNAME'] = name
160 160
161 plain = ui.configbool(b'hooks', b'%s:run-with-plain' % name)
161 if ui.config(b'hooks', b'%s:run-with-plain' % name) == b'auto':
162 plain = ui.plain()
163 else:
164 plain = ui.configbool(b'hooks', b'%s:run-with-plain' % name)
162 165 if plain:
163 166 env[b'HGPLAIN'] = b'1'
164 167 else:
@@ -1412,16 +1412,20 b' HGPLAIN setting in hooks'
1412 1412 > pre-version.testing-yes:run-with-plain=yes
1413 1413 > pre-version.testing-no=echo '### no ########' plain: \${HGPLAIN:-'<unset>'}
1414 1414 > pre-version.testing-no:run-with-plain=no
1415 > pre-version.testing-auto=echo '### auto ######' plain: \${HGPLAIN:-'<unset>'}
1416 > pre-version.testing-auto:run-with-plain=auto
1415 1417 > EOF
1416 1418
1417 1419 $ (unset HGPLAIN; hg version --quiet)
1418 1420 ### default ### plain: 1
1419 1421 ### yes ####### plain: 1
1420 1422 ### no ######## plain: <unset>
1423 ### auto ###### plain: <unset>
1421 1424 Mercurial Distributed SCM (*) (glob)
1422 1425
1423 1426 $ HGPLAIN=1 hg version --quiet
1424 1427 ### default ### plain: 1
1425 1428 ### yes ####### plain: 1
1426 1429 ### no ######## plain: <unset>
1430 ### auto ###### plain: 1
1427 1431 Mercurial Distributed SCM (*) (glob)
General Comments 0
You need to be logged in to leave comments. Login now