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