Mercurial > hg
comparison tests/test-ssh.t @ 30234:34a5f6c66bc5 stable
tests: invoke printenv.py via sh -c for test portability
On Windows platform, invoking printenv.py directly via hook is
problematic, because:
- unless binding between *.py suffix and python runtime, application
selector dialog is displayed, and running test is blocked at each
printenv.py invocations
- it isn't safe to assume binding between *.py suffix and python
runtime, because application binding is easily broken
For example, installing IDE (VisualStudio with Python Tools, or
so) often requires binding between source files and IDE itself.
This patch invokes printenv.py via sh -c for test portability. This is
a kind of follow up for d19787db6fe0, which eliminated explicit
"python" for printenv.py. There are already other 'sh -c "printenv.py"'
in *.t files, and this fix should be reasonable.
This changes were confirmed in cases below:
- without any application binding for *.py suffix
- with binding between *.py suffix and VisualStudio
This patch also replaces "echo + redirection" style with "heredoc"
style, because:
- hook command line is parsed by cmd.exe as shell at first, and
- single quotation can't quote arguments on cmd.exe, therefore,
- "printenv.py foobar" should be quoted by double quotation, but
- nested quoting (or tricky escaping) isn't readable
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sat, 29 Oct 2016 02:44:45 +0900 |
parents | b7a966ce89ed |
children | ad56204f733e |
comparison
equal
deleted
inserted
replaced
30233:3afde791dce1 | 30234:34a5f6c66bc5 |
---|---|
30 $ cat <<EOF > .hg/hgrc | 30 $ cat <<EOF > .hg/hgrc |
31 > [server] | 31 > [server] |
32 > uncompressed = True | 32 > uncompressed = True |
33 > | 33 > |
34 > [hooks] | 34 > [hooks] |
35 > changegroup = printenv.py changegroup-in-remote 0 ../dummylog | 35 > changegroup = sh -c "printenv.py changegroup-in-remote 0 ../dummylog" |
36 > EOF | 36 > EOF |
37 $ cd .. | 37 $ cd .. |
38 | 38 |
39 repo not found error | 39 repo not found error |
40 | 40 |
106 checking changesets | 106 checking changesets |
107 checking manifests | 107 checking manifests |
108 crosschecking files in changesets and manifests | 108 crosschecking files in changesets and manifests |
109 checking files | 109 checking files |
110 2 files, 3 changesets, 2 total revisions | 110 2 files, 3 changesets, 2 total revisions |
111 $ echo '[hooks]' >> .hg/hgrc | 111 $ cat >> .hg/hgrc <<EOF |
112 $ echo "changegroup = printenv.py changegroup-in-local 0 ../dummylog" >> .hg/hgrc | 112 > [hooks] |
113 > changegroup = sh -c "printenv.py changegroup-in-local 0 ../dummylog" | |
114 > EOF | |
113 | 115 |
114 empty default pull | 116 empty default pull |
115 | 117 |
116 $ hg paths | 118 $ hg paths |
117 default = ssh://user@dummy/remote | 119 default = ssh://user@dummy/remote |