##// END OF EJS Templates
hooks: introduce a `:run-with-plain` option for hooks...
marmoute -
r47242:7289eac7 stable
parent child Browse files
Show More
@@ -1315,6 +1315,12 b' coreconfigitem('
1315 generic=True,
1315 generic=True,
1316 )
1316 )
1317 coreconfigitem(
1317 coreconfigitem(
1318 b'hooks',
1319 b'.*:run-with-plain',
1320 default=True,
1321 generic=True,
1322 )
1323 coreconfigitem(
1318 b'hgweb-paths',
1324 b'hgweb-paths',
1319 b'.*',
1325 b'.*',
1320 default=list,
1326 default=list,
@@ -1027,6 +1027,11 b' Example ``.hg/hgrc``::'
1027 incoming.autobuild = /my/build/hook
1027 incoming.autobuild = /my/build/hook
1028 # force autobuild hook to run before other incoming hooks
1028 # force autobuild hook to run before other incoming hooks
1029 priority.incoming.autobuild = 1
1029 priority.incoming.autobuild = 1
1030 ### control HGPLAIN setting when running autobuild hook
1031 # HGPLAIN always set (default from Mercurial 5.7)
1032 incoming.autobuild:run-with-plain = yes
1033 # HGPLAIN never set
1034 incoming.autobuild:run-with-plain = no
1030
1035
1031 Most hooks are run with environment variables set that give useful
1036 Most hooks are run with environment variables set that give useful
1032 additional information. For each hook below, the environment variables
1037 additional information. For each hook below, the environment variables
@@ -157,7 +157,12 b' def _exthook(ui, repo, htype, name, cmd,'
157 env[b'HG_PENDING'] = repo.root
157 env[b'HG_PENDING'] = repo.root
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 env[b'HGPLAIN'] = b'1'
160
161 plain = ui.configbool(b'hooks', b'%s:run-with-plain' % name)
162 if plain:
163 env[b'HGPLAIN'] = b'1'
164 else:
165 env[b'HGPLAIN'] = b''
161
166
162 for k, v in pycompat.iteritems(args):
167 for k, v in pycompat.iteritems(args):
163 # transaction changes can accumulate MBs of data, so skip it
168 # transaction changes can accumulate MBs of data, so skip it
@@ -1407,13 +1407,21 b' HGPLAIN setting in hooks'
1407
1407
1408 $ cat << EOF >> .hg/hgrc
1408 $ cat << EOF >> .hg/hgrc
1409 > [hooks]
1409 > [hooks]
1410 > pre-version.testing-default=echo '### default ###' plain: \$HGPLAIN
1410 > pre-version.testing-default=echo '### default ###' plain: \${HGPLAIN:-'<unset>'}
1411 > pre-version.testing-yes=echo '### yes #######' plain: \${HGPLAIN:-'<unset>'}
1412 > pre-version.testing-yes:run-with-plain=yes
1413 > pre-version.testing-no=echo '### no ########' plain: \${HGPLAIN:-'<unset>'}
1414 > pre-version.testing-no:run-with-plain=no
1411 > EOF
1415 > EOF
1412
1416
1413 $ (unset HGPLAIN; hg version --quiet)
1417 $ (unset HGPLAIN; hg version --quiet)
1414 ### default ### plain: 1
1418 ### default ### plain: 1
1419 ### yes ####### plain: 1
1420 ### no ######## plain: <unset>
1415 Mercurial Distributed SCM (*) (glob)
1421 Mercurial Distributed SCM (*) (glob)
1416
1422
1417 $ HGPLAIN=1 hg version --quiet
1423 $ HGPLAIN=1 hg version --quiet
1418 ### default ### plain: 1
1424 ### default ### plain: 1
1425 ### yes ####### plain: 1
1426 ### no ######## plain: <unset>
1419 Mercurial Distributed SCM (*) (glob)
1427 Mercurial Distributed SCM (*) (glob)
General Comments 0
You need to be logged in to leave comments. Login now