author | Matt Mackall <mpm@selenic.com> |
Sun, 26 Sep 2010 13:44:49 -0500 | |
changeset 12489 | d039c4285092 |
parent 12414 | 858fe1e74785 |
child 12504 | f7dd8bffe18c |
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 |
|
12414 | 144 |
push |
1110 | 145 |
|
12414 | 146 |
$ hg push |
147 |
pushing to ssh://user@dummy/remote |
|
148 |
searching for changes |
|
149 |
remote: adding changesets |
|
150 |
remote: adding manifests |
|
151 |
remote: adding file changes |
|
152 |
remote: added 1 changesets with 1 changes to 1 files |
|
153 |
$ cd ../remote |
|
154 |
||
155 |
check remote tip |
|
1110 | 156 |
|
12414 | 157 |
$ hg tip |
158 |
changeset: 1:a28a9d1a809c |
|
159 |
tag: tip |
|
160 |
user: test |
|
161 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
162 |
summary: add |
|
163 |
||
164 |
$ hg verify |
|
165 |
checking changesets |
|
166 |
checking manifests |
|
167 |
crosschecking files in changesets and manifests |
|
168 |
checking files |
|
169 |
2 files, 2 changesets, 3 total revisions |
|
170 |
$ hg cat -r tip foo |
|
171 |
bleah |
|
172 |
$ echo z > z |
|
173 |
$ hg ci -A -m z z |
|
174 |
created new head |
|
1982
70ba0c86da8b
Added test for incoming via ssh.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1933
diff
changeset
|
175 |
|
12414 | 176 |
a bad, evil hook that prints to stdout |
1110 | 177 |
|
12414 | 178 |
$ echo 'changegroup.stdout = python ../badhook' >> .hg/hgrc |
179 |
$ cd ../local |
|
180 |
$ echo r > r |
|
181 |
$ hg ci -A -m z r |
|
182 |
||
183 |
push should succeed even though it has an unexpected response |
|
1110 | 184 |
|
12414 | 185 |
$ hg push |
186 |
pushing to ssh://user@dummy/remote |
|
187 |
searching for changes |
|
188 |
note: unsynced remote changes! |
|
189 |
remote: adding changesets |
|
190 |
remote: adding manifests |
|
191 |
remote: adding file changes |
|
192 |
remote: added 1 changesets with 1 changes to 1 files |
|
193 |
remote: KABOOM |
|
194 |
$ hg -R ../remote heads |
|
195 |
changeset: 3:1383141674ec |
|
196 |
tag: tip |
|
197 |
parent: 1:a28a9d1a809c |
|
198 |
user: test |
|
199 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
200 |
summary: z |
|
201 |
||
202 |
changeset: 2:6c0482d977a3 |
|
203 |
parent: 0:1160648e36ce |
|
204 |
user: test |
|
205 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
206 |
summary: z |
|
207 |
||
208 |
$ cd .. |
|
209 |
$ cat dummylog |
|
210 |
Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio |
|
211 |
Got arguments 1:user@dummy 2:hg -R */nonexistent serve --stdio (glob) |
|
212 |
Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
213 |
Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
214 |
Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
215 |
Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
216 |
Got arguments 1:user@dummy 2:hg -R local serve --stdio |
|
217 |
Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
218 |
changegroup-in-remote hook: HG_NODE=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1 |
|
219 |
Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
220 |
changegroup-in-remote hook: HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1 |