##// END OF EJS Templates
hook: disable the shell to native command translation by default...
Matt Harbison -
r38745:2009d84f default
parent child Browse files
Show More
@@ -891,16 +891,17 b' be ``$HG_HOOKTYPE=incoming`` and ``$HG_H'
891
891
892 .. container:: windows
892 .. container:: windows
893
893
894 Some basic Unix syntax is supported for portability, including ``$VAR``
894 Some basic Unix syntax can be enabled for portability, including ``$VAR``
895 and ``${VAR}`` style variables. To use a literal ``$``, it must be
895 and ``${VAR}`` style variables. To use a literal ``$``, it must be
896 escaped with a back slash or inside of a strong quote. This can be
896 escaped with a back slash or inside of a strong quote.
897 disabled by adding a prefix of ``tonative.`` to the hook name on a new
897
898 line, and setting it to ``False``. For example::
898 This feature is enabled by adding a prefix of ``tonative.`` to the hook
899 name on a new line, and setting it to ``True``. For example::
899
900
900 [hooks]
901 [hooks]
901 incoming.autobuild = /my/build/hook
902 incoming.autobuild = /my/build/hook
902 # disable translation to cmd.exe syntax for autobuild hook
903 # enable translation to cmd.exe syntax for autobuild hook
903 tonative.incoming.autobuild = False
904 tonative.incoming.autobuild = True
904
905
905 ``changegroup``
906 ``changegroup``
906 Run after a changegroup has been added via push, pull or unbundle. The ID of
907 Run after a changegroup has been added via push, pull or unbundle. The ID of
@@ -139,7 +139,7 b' def _exthook(ui, repo, htype, name, cmd,'
139 v = stringutil.pprint(v)
139 v = stringutil.pprint(v)
140 env['HG_' + k.upper()] = v
140 env['HG_' + k.upper()] = v
141
141
142 if ui.configbool('hooks', 'tonative.%s' % name, pycompat.iswindows):
142 if ui.configbool('hooks', 'tonative.%s' % name, False):
143 ui.note(_('converting hook "%s" to native\n') % name)
143 ui.note(_('converting hook "%s" to native\n') % name)
144 cmd = procutil.shelltonative(cmd, env)
144 cmd = procutil.shelltonative(cmd, env)
145
145
@@ -194,7 +194,6 b' delete a remote bookmark'
194 bundle2-input: part header size: 0
194 bundle2-input: part header size: 0
195 bundle2-input: end of bundle2 stream
195 bundle2-input: end of bundle2 stream
196 bundle2-input-bundle: 3 parts total
196 bundle2-input-bundle: 3 parts total
197 converting hook "txnclose-bookmark.test" to native (windows !)
198 running hook txnclose-bookmark.test: sh $TESTTMP/hook.sh
197 running hook txnclose-bookmark.test: sh $TESTTMP/hook.sh
199 test-hook-bookmark: W: 0000000000000000000000000000000000000000 ->
198 test-hook-bookmark: W: 0000000000000000000000000000000000000000 ->
200 bundle2-output-bundle: "HG20", 1 parts total
199 bundle2-output-bundle: "HG20", 1 parts total
@@ -309,7 +308,6 b' delete a remote bookmark'
309 bundle2-input: part header size: 0
308 bundle2-input: part header size: 0
310 bundle2-input: end of bundle2 stream
309 bundle2-input: end of bundle2 stream
311 bundle2-input-bundle: 3 parts total
310 bundle2-input-bundle: 3 parts total
312 converting hook "txnclose-bookmark.test" to native (windows !)
313 running hook txnclose-bookmark.test: sh $TESTTMP/hook.sh
311 running hook txnclose-bookmark.test: sh $TESTTMP/hook.sh
314 test-hook-bookmark: W: 0000000000000000000000000000000000000000 ->
312 test-hook-bookmark: W: 0000000000000000000000000000000000000000 ->
315 bundle2-output-bundle: "HG20", 0 parts total
313 bundle2-output-bundle: "HG20", 0 parts total
@@ -205,7 +205,6 b' at first, test saving last-message.txt'
205 a
205 a
206 committing manifest
206 committing manifest
207 committing changelog
207 committing changelog
208 converting hook "pretxncommit.test-saving-last-message" to native (windows !)
209 running hook pretxncommit.test-saving-last-message: false
208 running hook pretxncommit.test-saving-last-message: false
210 transaction abort!
209 transaction abort!
211 rollback completed
210 rollback completed
@@ -231,7 +230,6 b' at first, test saving last-message.txt'
231 a
230 a
232 committing manifest
231 committing manifest
233 committing changelog
232 committing changelog
234 converting hook "pretxncommit.test-saving-last-message" to native (windows !)
235 running hook pretxncommit.test-saving-last-message: false
233 running hook pretxncommit.test-saving-last-message: false
236 transaction abort!
234 transaction abort!
237 rollback completed
235 rollback completed
@@ -478,7 +478,8 b' This is an excuse to test hook with hist'
478 1:199b6bb90248 b
478 1:199b6bb90248 b
479 0:6c795aa153cb a
479 0:6c795aa153cb a
480
480
481 $ hg histedit 6c795aa153cb --config hooks.commit='echo commit $HG_NODE' --commands - 2>&1 << EOF | fixbundle
481 $ hg histedit 6c795aa153cb --config hooks.commit='echo commit $HG_NODE' --config hooks.tonative.commit=True \
482 > --commands - 2>&1 << EOF | fixbundle
482 > pick 199b6bb90248 b
483 > pick 199b6bb90248 b
483 > fold a1a953ffb4b0 c
484 > fold a1a953ffb4b0 c
484 > pick 6c795aa153cb a
485 > pick 6c795aa153cb a
@@ -494,8 +495,8 b' Test unix -> windows style variable subs'
494 $ cat > $TESTTMP/tmp.hgrc <<'EOF'
495 $ cat > $TESTTMP/tmp.hgrc <<'EOF'
495 > [hooks]
496 > [hooks]
496 > pre-add = echo no variables
497 > pre-add = echo no variables
497 > tonative.pre-add = False
498 > post-add = echo ran $HG_ARGS, literal \$non-var, 'also $non-var', $HG_RESULT
498 > post-add = echo ran $HG_ARGS, literal \$non-var, 'also $non-var', $HG_RESULT
499 > tonative.post-add = True
499 > EOF
500 > EOF
500
501
501 TODO: Windows should output double quotes around "also $non-var"
502 TODO: Windows should output double quotes around "also $non-var"
@@ -183,7 +183,6 b' Commit with several checks'
183 overwriting a expanding keywords
183 overwriting a expanding keywords
184 updating the branch cache
184 updating the branch cache
185 committed changeset 1:ef63ca68695bc9495032c6fda1350c71e6d256e9
185 committed changeset 1:ef63ca68695bc9495032c6fda1350c71e6d256e9
186 converting hook "commit.test" to native (windows !)
187 running hook commit.test: cp a hooktest
186 running hook commit.test: cp a hooktest
188 $ hg status
187 $ hg status
189 ? hooktest
188 ? hooktest
@@ -90,13 +90,10 b' expect success'
90 remote: adding a revisions
90 remote: adding a revisions
91 remote: added 1 changesets with 1 changes to 1 files
91 remote: added 1 changesets with 1 changes to 1 files
92 remote: updating the branch cache
92 remote: updating the branch cache
93 remote: converting hook "txnclose-phase.test" to native (windows !)
94 remote: running hook txnclose-phase.test: sh $TESTTMP/hook.sh
93 remote: running hook txnclose-phase.test: sh $TESTTMP/hook.sh
95 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
94 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
96 remote: converting hook "txnclose-phase.test" to native (windows !)
97 remote: running hook txnclose-phase.test: sh $TESTTMP/hook.sh
95 remote: running hook txnclose-phase.test: sh $TESTTMP/hook.sh
98 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
96 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
99 remote: converting hook "changegroup" to native (windows !)
100 remote: running hook changegroup: sh -c "printenv.py changegroup 0"
97 remote: running hook changegroup: sh -c "printenv.py changegroup 0"
101 remote: changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
98 remote: changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
102 % serve errors
99 % serve errors
@@ -113,13 +110,10 b' expect success'
113 remote: adding a revisions
110 remote: adding a revisions
114 remote: added 1 changesets with 1 changes to 1 files
111 remote: added 1 changesets with 1 changes to 1 files
115 remote: updating the branch cache
112 remote: updating the branch cache
116 remote: converting hook "txnclose-phase.test" to native (windows !)
117 remote: running hook txnclose-phase.test: sh $TESTTMP/hook.sh
113 remote: running hook txnclose-phase.test: sh $TESTTMP/hook.sh
118 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
114 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
119 remote: converting hook "txnclose-phase.test" to native (windows !)
120 remote: running hook txnclose-phase.test: sh $TESTTMP/hook.sh
115 remote: running hook txnclose-phase.test: sh $TESTTMP/hook.sh
121 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
116 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
122 remote: converting hook "changegroup" to native (windows !)
123 remote: running hook changegroup: sh -c "printenv.py changegroup 0"
117 remote: running hook changegroup: sh -c "printenv.py changegroup 0"
124 remote: changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
118 remote: changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
125 % serve errors
119 % serve errors
@@ -333,7 +333,8 b' Test rebase interrupted by hooks'
333
333
334 $ cp -R a3 hook-pretxncommit
334 $ cp -R a3 hook-pretxncommit
335 $ cd hook-pretxncommit
335 $ cd hook-pretxncommit
336 $ hg rebase --source 2 --dest 5 --tool internal:other --config 'hooks.pretxncommit=hg log -r $HG_NODE | grep "summary: C"'
336 $ hg rebase --source 2 --dest 5 --tool internal:other \
337 > --config 'hooks.tonative.pretxncommit=True' --config 'hooks.pretxncommit=hg log -r $HG_NODE | grep "summary: C"'
337 rebasing 2:965c486023db "C"
338 rebasing 2:965c486023db "C"
338 summary: C
339 summary: C
339 rebasing 6:a0b2430ebfb8 "F" (tip)
340 rebasing 6:a0b2430ebfb8 "F" (tip)
General Comments 0
You need to be logged in to leave comments. Login now