author | Christian Ebert <blacktrash@gmx.net> |
Fri, 08 Oct 2010 18:39:46 +0100 | |
changeset 12627 | 7d9162892899 |
parent 12587 | e3247ceaca5e |
child 12640 | 6cc4b14fb76b |
permissions | -rw-r--r-- |
1110 | 1 |
|
12414 | 2 |
$ cp "$TESTDIR"/printenv.py . |
4291
35b2e02367a5
test-ssh: use printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3853
diff
changeset
|
3 |
|
12414 | 4 |
This test tries to exercise the ssh functionality with a dummy script |
1110 | 5 |
|
12414 | 6 |
$ cat <<EOF > dummyssh |
7 |
> import sys |
|
8 |
> import os |
|
12489 | 9 |
> |
12414 | 10 |
> os.chdir(os.path.dirname(sys.argv[0])) |
11 |
> if sys.argv[1] != "user@dummy": |
|
12 |
> sys.exit(-1) |
|
12489 | 13 |
> |
12414 | 14 |
> if not os.path.exists("dummyssh"): |
15 |
> sys.exit(-1) |
|
12489 | 16 |
> |
12414 | 17 |
> os.environ["SSH_CLIENT"] = "127.0.0.1 1 2" |
12489 | 18 |
> |
12414 | 19 |
> log = open("dummylog", "ab") |
20 |
> log.write("Got arguments") |
|
21 |
> for i, arg in enumerate(sys.argv[1:]): |
|
22 |
> log.write(" %d:%s" % (i+1, arg)) |
|
23 |
> log.write("\n") |
|
24 |
> log.close() |
|
25 |
> r = os.system(sys.argv[2]) |
|
26 |
> sys.exit(bool(r)) |
|
27 |
> EOF |
|
28 |
$ cat <<EOF > badhook |
|
29 |
> import sys |
|
30 |
> sys.stdout.write("KABOOM\n") |
|
31 |
> EOF |
|
1110 | 32 |
|
12489 | 33 |
creating 'remote |
4298
58517f6eb1ad
test-ssh: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4291
diff
changeset
|
34 |
|
12414 | 35 |
$ hg init remote |
36 |
$ cd remote |
|
37 |
$ echo this > foo |
|
38 |
$ echo this > fooO |
|
39 |
$ hg ci -A -m "init" foo fooO |
|
40 |
$ echo '[server]' > .hg/hgrc |
|
41 |
$ echo 'uncompressed = True' >> .hg/hgrc |
|
42 |
$ echo '[hooks]' >> .hg/hgrc |
|
43 |
$ echo 'changegroup = python ../printenv.py changegroup-in-remote 0 ../dummylog' >> .hg/hgrc |
|
44 |
$ cd .. |
|
1110 | 45 |
|
12414 | 46 |
repo not found error |
47 |
||
48 |
$ hg clone -e "python ./dummyssh" ssh://user@dummy/nonexistent local |
|
49 |
remote: abort: There is no Mercurial repository here (.hg not found)! |
|
50 |
abort: no suitable response from remote hg! |
|
51 |
[255] |
|
52 |
||
53 |
non-existent absolute path |
|
1110 | 54 |
|
12414 | 55 |
$ hg clone -e "python ./dummyssh" ssh://user@dummy//$HGTMP/nonexistent local |
56 |
remote: abort: There is no Mercurial repository here (.hg not found)! |
|
57 |
abort: no suitable response from remote hg! |
|
58 |
[255] |
|
59 |
||
60 |
clone remote via stream |
|
1110 | 61 |
|
12489 | 62 |
$ hg clone -e "python ./dummyssh" --uncompressed ssh://user@dummy/remote local-stream |
12414 | 63 |
streaming all changes |
12489 | 64 |
4 files to transfer, 392 bytes of data |
65 |
transferred 392 bytes in * seconds (*B/sec) (glob) |
|
12414 | 66 |
updating to branch default |
12489 | 67 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
12414 | 68 |
$ cd local-stream |
69 |
$ hg verify |
|
70 |
checking changesets |
|
71 |
checking manifests |
|
72 |
crosschecking files in changesets and manifests |
|
73 |
checking files |
|
74 |
2 files, 1 changesets, 2 total revisions |
|
75 |
$ cd .. |
|
76 |
||
77 |
clone remote via pull |
|
5978
7939c71f3132
sshrepo: be more careful while reading data
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4298
diff
changeset
|
78 |
|
12414 | 79 |
$ hg clone -e "python ./dummyssh" ssh://user@dummy/remote local |
80 |
requesting all changes |
|
81 |
adding changesets |
|
82 |
adding manifests |
|
83 |
adding file changes |
|
84 |
added 1 changesets with 2 changes to 2 files |
|
85 |
updating to branch default |
|
86 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
87 |
||
88 |
verify |
|
1110 | 89 |
|
12414 | 90 |
$ cd local |
91 |
$ hg verify |
|
92 |
checking changesets |
|
93 |
checking manifests |
|
94 |
crosschecking files in changesets and manifests |
|
95 |
checking files |
|
96 |
2 files, 1 changesets, 2 total revisions |
|
97 |
$ echo '[hooks]' >> .hg/hgrc |
|
98 |
$ echo 'changegroup = python ../printenv.py changegroup-in-local 0 ../dummylog' >> .hg/hgrc |
|
1110 | 99 |
|
12414 | 100 |
empty default pull |
3275
7ae37d99d47e
ssh: make the error message more clear, add a testcase
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3095
diff
changeset
|
101 |
|
12414 | 102 |
$ hg paths |
103 |
default = ssh://user@dummy/remote |
|
104 |
$ hg pull -e "python ../dummyssh" |
|
105 |
pulling from ssh://user@dummy/remote |
|
106 |
searching for changes |
|
107 |
no changes found |
|
108 |
||
109 |
local change |
|
12409
0eaf7d32a5d8
test-ssh: test absolute paths in SSH URLs
Brodie Rao <brodie@bitheap.org>
parents:
12156
diff
changeset
|
110 |
|
12414 | 111 |
$ echo bleah > foo |
112 |
$ hg ci -m "add" |
|
113 |
||
114 |
updating rc |
|
115 |
||
116 |
$ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc |
|
117 |
$ echo "[ui]" >> .hg/hgrc |
|
118 |
$ echo "ssh = python ../dummyssh" >> .hg/hgrc |
|
119 |
||
120 |
find outgoing |
|
2612
ffb895f16925
add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2439
diff
changeset
|
121 |
|
12414 | 122 |
$ hg out ssh://user@dummy/remote |
123 |
comparing with ssh://user@dummy/remote |
|
124 |
searching for changes |
|
125 |
changeset: 1:a28a9d1a809c |
|
126 |
tag: tip |
|
127 |
user: test |
|
128 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
129 |
summary: add |
|
130 |
||
1110 | 131 |
|
12414 | 132 |
find incoming on the remote side |
1110 | 133 |
|
12414 | 134 |
$ hg incoming -R ../remote -e "python ../dummyssh" ssh://user@dummy/local |
135 |
comparing with ssh://user@dummy/local |
|
136 |
searching for changes |
|
137 |
changeset: 1:a28a9d1a809c |
|
138 |
tag: tip |
|
139 |
user: test |
|
140 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
141 |
summary: add |
|
142 |
||
1110 | 143 |
|
12504
f7dd8bffe18c
test-ssh: test absolute path that exists
Brodie Rao <brodie@bitheap.org>
parents:
12489
diff
changeset
|
144 |
find incoming on the remote side (using absolute path) |
f7dd8bffe18c
test-ssh: test absolute path that exists
Brodie Rao <brodie@bitheap.org>
parents:
12489
diff
changeset
|
145 |
|
f7dd8bffe18c
test-ssh: test absolute path that exists
Brodie Rao <brodie@bitheap.org>
parents:
12489
diff
changeset
|
146 |
$ hg incoming -R ../remote -e "python ../dummyssh" "ssh://user@dummy/`pwd`" |
12587
e3247ceaca5e
tests: removed test names in tests
Erik Zielke <ez@aragost.com>
parents:
12504
diff
changeset
|
147 |
comparing with ssh://user@dummy/*/local (glob) |
12504
f7dd8bffe18c
test-ssh: test absolute path that exists
Brodie Rao <brodie@bitheap.org>
parents:
12489
diff
changeset
|
148 |
searching for changes |
f7dd8bffe18c
test-ssh: test absolute path that exists
Brodie Rao <brodie@bitheap.org>
parents:
12489
diff
changeset
|
149 |
changeset: 1:a28a9d1a809c |
f7dd8bffe18c
test-ssh: test absolute path that exists
Brodie Rao <brodie@bitheap.org>
parents:
12489
diff
changeset
|
150 |
tag: tip |
f7dd8bffe18c
test-ssh: test absolute path that exists
Brodie Rao <brodie@bitheap.org>
parents:
12489
diff
changeset
|
151 |
user: test |
f7dd8bffe18c
test-ssh: test absolute path that exists
Brodie Rao <brodie@bitheap.org>
parents:
12489
diff
changeset
|
152 |
date: Thu Jan 01 00:00:00 1970 +0000 |
f7dd8bffe18c
test-ssh: test absolute path that exists
Brodie Rao <brodie@bitheap.org>
parents:
12489
diff
changeset
|
153 |
summary: add |
f7dd8bffe18c
test-ssh: test absolute path that exists
Brodie Rao <brodie@bitheap.org>
parents:
12489
diff
changeset
|
154 |
|
f7dd8bffe18c
test-ssh: test absolute path that exists
Brodie Rao <brodie@bitheap.org>
parents:
12489
diff
changeset
|
155 |
|
12414 | 156 |
push |
1110 | 157 |
|
12414 | 158 |
$ hg push |
159 |
pushing to ssh://user@dummy/remote |
|
160 |
searching for changes |
|
161 |
remote: adding changesets |
|
162 |
remote: adding manifests |
|
163 |
remote: adding file changes |
|
164 |
remote: added 1 changesets with 1 changes to 1 files |
|
165 |
$ cd ../remote |
|
166 |
||
167 |
check remote tip |
|
1110 | 168 |
|
12414 | 169 |
$ hg tip |
170 |
changeset: 1:a28a9d1a809c |
|
171 |
tag: tip |
|
172 |
user: test |
|
173 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
174 |
summary: add |
|
175 |
||
176 |
$ hg verify |
|
177 |
checking changesets |
|
178 |
checking manifests |
|
179 |
crosschecking files in changesets and manifests |
|
180 |
checking files |
|
181 |
2 files, 2 changesets, 3 total revisions |
|
182 |
$ hg cat -r tip foo |
|
183 |
bleah |
|
184 |
$ echo z > z |
|
185 |
$ hg ci -A -m z z |
|
186 |
created new head |
|
1982
70ba0c86da8b
Added test for incoming via ssh.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1933
diff
changeset
|
187 |
|
12414 | 188 |
a bad, evil hook that prints to stdout |
1110 | 189 |
|
12414 | 190 |
$ echo 'changegroup.stdout = python ../badhook' >> .hg/hgrc |
191 |
$ cd ../local |
|
192 |
$ echo r > r |
|
193 |
$ hg ci -A -m z r |
|
194 |
||
195 |
push should succeed even though it has an unexpected response |
|
1110 | 196 |
|
12414 | 197 |
$ hg push |
198 |
pushing to ssh://user@dummy/remote |
|
199 |
searching for changes |
|
200 |
note: unsynced remote changes! |
|
201 |
remote: adding changesets |
|
202 |
remote: adding manifests |
|
203 |
remote: adding file changes |
|
204 |
remote: added 1 changesets with 1 changes to 1 files |
|
205 |
remote: KABOOM |
|
206 |
$ hg -R ../remote heads |
|
207 |
changeset: 3:1383141674ec |
|
208 |
tag: tip |
|
209 |
parent: 1:a28a9d1a809c |
|
210 |
user: test |
|
211 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
212 |
summary: z |
|
213 |
||
214 |
changeset: 2:6c0482d977a3 |
|
215 |
parent: 0:1160648e36ce |
|
216 |
user: test |
|
217 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
218 |
summary: z |
|
219 |
||
220 |
$ cd .. |
|
221 |
$ cat dummylog |
|
222 |
Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio |
|
223 |
Got arguments 1:user@dummy 2:hg -R */nonexistent serve --stdio (glob) |
|
224 |
Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
225 |
Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
226 |
Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
227 |
Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
228 |
Got arguments 1:user@dummy 2:hg -R local serve --stdio |
|
12587
e3247ceaca5e
tests: removed test names in tests
Erik Zielke <ez@aragost.com>
parents:
12504
diff
changeset
|
229 |
Got arguments 1:user@dummy 2:hg -R /*/local serve --stdio (glob) |
12414 | 230 |
Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
231 |
changegroup-in-remote hook: HG_NODE=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1 |
|
232 |
Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
233 |
changegroup-in-remote hook: HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1 |