##// END OF EJS Templates
tests: fix test-ssh.t after 6bd9778ae749
Mads Kiilerich -
r14185:eb297845 default
parent child Browse files
Show More
@@ -1,310 +1,312 b''
1
1
2
2
3 This test tries to exercise the ssh functionality with a dummy script
3 This test tries to exercise the ssh functionality with a dummy script
4
4
5 $ cat <<EOF > dummyssh
5 $ cat <<EOF > dummyssh
6 > import sys
6 > import sys
7 > import os
7 > import os
8 >
8 >
9 > os.chdir(os.path.dirname(sys.argv[0]))
9 > os.chdir(os.path.dirname(sys.argv[0]))
10 > if sys.argv[1] != "user@dummy":
10 > if sys.argv[1] != "user@dummy":
11 > sys.exit(-1)
11 > sys.exit(-1)
12 >
12 >
13 > if not os.path.exists("dummyssh"):
13 > if not os.path.exists("dummyssh"):
14 > sys.exit(-1)
14 > sys.exit(-1)
15 >
15 >
16 > os.environ["SSH_CLIENT"] = "127.0.0.1 1 2"
16 > os.environ["SSH_CLIENT"] = "127.0.0.1 1 2"
17 >
17 >
18 > log = open("dummylog", "ab")
18 > log = open("dummylog", "ab")
19 > log.write("Got arguments")
19 > log.write("Got arguments")
20 > for i, arg in enumerate(sys.argv[1:]):
20 > for i, arg in enumerate(sys.argv[1:]):
21 > log.write(" %d:%s" % (i+1, arg))
21 > log.write(" %d:%s" % (i+1, arg))
22 > log.write("\n")
22 > log.write("\n")
23 > log.close()
23 > log.close()
24 > r = os.system(sys.argv[2])
24 > r = os.system(sys.argv[2])
25 > sys.exit(bool(r))
25 > sys.exit(bool(r))
26 > EOF
26 > EOF
27 $ cat <<EOF > badhook
27 $ cat <<EOF > badhook
28 > import sys
28 > import sys
29 > sys.stdout.write("KABOOM\n")
29 > sys.stdout.write("KABOOM\n")
30 > EOF
30 > EOF
31
31
32 creating 'remote
32 creating 'remote' repo
33
33
34 $ hg init remote
34 $ hg init remote
35 $ cd remote
35 $ cd remote
36 $ echo this > foo
36 $ echo this > foo
37 $ echo this > fooO
37 $ echo this > fooO
38 $ hg ci -A -m "init" foo fooO
38 $ hg ci -A -m "init" foo fooO
39 $ echo <<EOF > .hg/hgrc
39 $ cat <<EOF > .hg/hgrc
40 > [server]
40 > [server]
41 > uncompressed = True
41 > uncompressed = True
42 >
42 >
43 > [hooks]
43 > [hooks]
44 > changegroup = python "$TESTDIR"/printenv.py changegroup-in-remote 0 ../dummylog
44 > changegroup = python "$TESTDIR"/printenv.py changegroup-in-remote 0 ../dummylog
45 > EOF
45 > EOF
46 $ cd ..
46 $ cd ..
47
47
48 repo not found error
48 repo not found error
49
49
50 $ hg clone -e "python ./dummyssh" ssh://user@dummy/nonexistent local
50 $ hg clone -e "python ./dummyssh" ssh://user@dummy/nonexistent local
51 remote: abort: There is no Mercurial repository here (.hg not found)!
51 remote: abort: There is no Mercurial repository here (.hg not found)!
52 abort: no suitable response from remote hg!
52 abort: no suitable response from remote hg!
53 [255]
53 [255]
54
54
55 non-existent absolute path
55 non-existent absolute path
56
56
57 $ hg clone -e "python ./dummyssh" ssh://user@dummy//`pwd`/nonexistent local
57 $ hg clone -e "python ./dummyssh" ssh://user@dummy//`pwd`/nonexistent local
58 remote: abort: There is no Mercurial repository here (.hg not found)!
58 remote: abort: There is no Mercurial repository here (.hg not found)!
59 abort: no suitable response from remote hg!
59 abort: no suitable response from remote hg!
60 [255]
60 [255]
61
61
62 clone remote via stream
62 clone remote via stream
63
63
64 $ hg clone -e "python ./dummyssh" --uncompressed ssh://user@dummy/remote local-stream
64 $ hg clone -e "python ./dummyssh" --uncompressed ssh://user@dummy/remote local-stream
65 streaming all changes
65 streaming all changes
66 4 files to transfer, 392 bytes of data
66 4 files to transfer, 392 bytes of data
67 transferred 392 bytes in * seconds (*/sec) (glob)
67 transferred 392 bytes in * seconds (*/sec) (glob)
68 updating to branch default
68 updating to branch default
69 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
69 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
70 $ cd local-stream
70 $ cd local-stream
71 $ hg verify
71 $ hg verify
72 checking changesets
72 checking changesets
73 checking manifests
73 checking manifests
74 crosschecking files in changesets and manifests
74 crosschecking files in changesets and manifests
75 checking files
75 checking files
76 2 files, 1 changesets, 2 total revisions
76 2 files, 1 changesets, 2 total revisions
77 $ cd ..
77 $ cd ..
78
78
79 clone remote via pull
79 clone remote via pull
80
80
81 $ hg clone -e "python ./dummyssh" ssh://user@dummy/remote local
81 $ hg clone -e "python ./dummyssh" ssh://user@dummy/remote local
82 requesting all changes
82 requesting all changes
83 adding changesets
83 adding changesets
84 adding manifests
84 adding manifests
85 adding file changes
85 adding file changes
86 added 1 changesets with 2 changes to 2 files
86 added 1 changesets with 2 changes to 2 files
87 updating to branch default
87 updating to branch default
88 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
88 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
89
89
90 verify
90 verify
91
91
92 $ cd local
92 $ cd local
93 $ hg verify
93 $ hg verify
94 checking changesets
94 checking changesets
95 checking manifests
95 checking manifests
96 crosschecking files in changesets and manifests
96 crosschecking files in changesets and manifests
97 checking files
97 checking files
98 2 files, 1 changesets, 2 total revisions
98 2 files, 1 changesets, 2 total revisions
99 $ echo '[hooks]' >> .hg/hgrc
99 $ echo '[hooks]' >> .hg/hgrc
100 $ echo 'changegroup = python "$TESTDIR"/printenv.py changegroup-in-local 0 ../dummylog' >> .hg/hgrc
100 $ echo 'changegroup = python "$TESTDIR"/printenv.py changegroup-in-local 0 ../dummylog' >> .hg/hgrc
101
101
102 empty default pull
102 empty default pull
103
103
104 $ hg paths
104 $ hg paths
105 default = ssh://user@dummy/remote
105 default = ssh://user@dummy/remote
106 $ hg pull -e "python ../dummyssh"
106 $ hg pull -e "python ../dummyssh"
107 pulling from ssh://user@dummy/remote
107 pulling from ssh://user@dummy/remote
108 searching for changes
108 searching for changes
109 no changes found
109 no changes found
110
110
111 local change
111 local change
112
112
113 $ echo bleah > foo
113 $ echo bleah > foo
114 $ hg ci -m "add"
114 $ hg ci -m "add"
115
115
116 updating rc
116 updating rc
117
117
118 $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
118 $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
119 $ echo "[ui]" >> .hg/hgrc
119 $ echo "[ui]" >> .hg/hgrc
120 $ echo "ssh = python ../dummyssh" >> .hg/hgrc
120 $ echo "ssh = python ../dummyssh" >> .hg/hgrc
121
121
122 find outgoing
122 find outgoing
123
123
124 $ hg out ssh://user@dummy/remote
124 $ hg out ssh://user@dummy/remote
125 comparing with ssh://user@dummy/remote
125 comparing with ssh://user@dummy/remote
126 searching for changes
126 searching for changes
127 changeset: 1:a28a9d1a809c
127 changeset: 1:a28a9d1a809c
128 tag: tip
128 tag: tip
129 user: test
129 user: test
130 date: Thu Jan 01 00:00:00 1970 +0000
130 date: Thu Jan 01 00:00:00 1970 +0000
131 summary: add
131 summary: add
132
132
133
133
134 find incoming on the remote side
134 find incoming on the remote side
135
135
136 $ hg incoming -R ../remote -e "python ../dummyssh" ssh://user@dummy/local
136 $ hg incoming -R ../remote -e "python ../dummyssh" ssh://user@dummy/local
137 comparing with ssh://user@dummy/local
137 comparing with ssh://user@dummy/local
138 searching for changes
138 searching for changes
139 changeset: 1:a28a9d1a809c
139 changeset: 1:a28a9d1a809c
140 tag: tip
140 tag: tip
141 user: test
141 user: test
142 date: Thu Jan 01 00:00:00 1970 +0000
142 date: Thu Jan 01 00:00:00 1970 +0000
143 summary: add
143 summary: add
144
144
145
145
146 find incoming on the remote side (using absolute path)
146 find incoming on the remote side (using absolute path)
147
147
148 $ hg incoming -R ../remote -e "python ../dummyssh" "ssh://user@dummy/`pwd`"
148 $ hg incoming -R ../remote -e "python ../dummyssh" "ssh://user@dummy/`pwd`"
149 comparing with ssh://user@dummy/$TESTTMP/local
149 comparing with ssh://user@dummy/$TESTTMP/local
150 searching for changes
150 searching for changes
151 changeset: 1:a28a9d1a809c
151 changeset: 1:a28a9d1a809c
152 tag: tip
152 tag: tip
153 user: test
153 user: test
154 date: Thu Jan 01 00:00:00 1970 +0000
154 date: Thu Jan 01 00:00:00 1970 +0000
155 summary: add
155 summary: add
156
156
157
157
158 push
158 push
159
159
160 $ hg push
160 $ hg push
161 pushing to ssh://user@dummy/remote
161 pushing to ssh://user@dummy/remote
162 searching for changes
162 searching for changes
163 remote: adding changesets
163 remote: adding changesets
164 remote: adding manifests
164 remote: adding manifests
165 remote: adding file changes
165 remote: adding file changes
166 remote: added 1 changesets with 1 changes to 1 files
166 remote: added 1 changesets with 1 changes to 1 files
167 $ cd ../remote
167 $ cd ../remote
168
168
169 check remote tip
169 check remote tip
170
170
171 $ hg tip
171 $ hg tip
172 changeset: 1:a28a9d1a809c
172 changeset: 1:a28a9d1a809c
173 tag: tip
173 tag: tip
174 user: test
174 user: test
175 date: Thu Jan 01 00:00:00 1970 +0000
175 date: Thu Jan 01 00:00:00 1970 +0000
176 summary: add
176 summary: add
177
177
178 $ hg verify
178 $ hg verify
179 checking changesets
179 checking changesets
180 checking manifests
180 checking manifests
181 crosschecking files in changesets and manifests
181 crosschecking files in changesets and manifests
182 checking files
182 checking files
183 2 files, 2 changesets, 3 total revisions
183 2 files, 2 changesets, 3 total revisions
184 $ hg cat -r tip foo
184 $ hg cat -r tip foo
185 bleah
185 bleah
186 $ echo z > z
186 $ echo z > z
187 $ hg ci -A -m z z
187 $ hg ci -A -m z z
188 created new head
188 created new head
189
189
190 test pushkeys and bookmarks
190 test pushkeys and bookmarks
191
191
192 $ cd ../local
192 $ cd ../local
193 $ hg debugpushkey --config ui.ssh="python ../dummyssh" ssh://user@dummy/remote namespaces
193 $ hg debugpushkey --config ui.ssh="python ../dummyssh" ssh://user@dummy/remote namespaces
194 bookmarks
194 bookmarks
195 namespaces
195 namespaces
196 $ hg book foo -r 0
196 $ hg book foo -r 0
197 $ hg out -B
197 $ hg out -B
198 comparing with ssh://user@dummy/remote
198 comparing with ssh://user@dummy/remote
199 searching for changed bookmarks
199 searching for changed bookmarks
200 foo 1160648e36ce
200 foo 1160648e36ce
201 $ hg push -B foo
201 $ hg push -B foo
202 pushing to ssh://user@dummy/remote
202 pushing to ssh://user@dummy/remote
203 searching for changes
203 searching for changes
204 no changes found
204 no changes found
205 exporting bookmark foo
205 exporting bookmark foo
206 $ hg debugpushkey --config ui.ssh="python ../dummyssh" ssh://user@dummy/remote bookmarks
206 $ hg debugpushkey --config ui.ssh="python ../dummyssh" ssh://user@dummy/remote bookmarks
207 foo 1160648e36cec0054048a7edc4110c6f84fde594
207 foo 1160648e36cec0054048a7edc4110c6f84fde594
208 $ hg book -f foo
208 $ hg book -f foo
209 $ hg push --traceback
209 $ hg push --traceback
210 pushing to ssh://user@dummy/remote
210 pushing to ssh://user@dummy/remote
211 searching for changes
211 searching for changes
212 no changes found
212 no changes found
213 updating bookmark foo
213 updating bookmark foo
214 $ hg book -d foo
214 $ hg book -d foo
215 $ hg in -B
215 $ hg in -B
216 comparing with ssh://user@dummy/remote
216 comparing with ssh://user@dummy/remote
217 searching for changed bookmarks
217 searching for changed bookmarks
218 foo a28a9d1a809c
218 foo a28a9d1a809c
219 $ hg book -f -r 0 foo
219 $ hg book -f -r 0 foo
220 $ hg pull -B foo
220 $ hg pull -B foo
221 pulling from ssh://user@dummy/remote
221 pulling from ssh://user@dummy/remote
222 no changes found
222 no changes found
223 updating bookmark foo
223 updating bookmark foo
224 importing bookmark foo
224 importing bookmark foo
225 $ hg book -d foo
225 $ hg book -d foo
226 $ hg push -B foo
226 $ hg push -B foo
227 pushing to ssh://user@dummy/remote
227 pushing to ssh://user@dummy/remote
228 searching for changes
228 searching for changes
229 no changes found
229 no changes found
230 deleting remote bookmark foo
230 deleting remote bookmark foo
231
231
232 a bad, evil hook that prints to stdout
232 a bad, evil hook that prints to stdout
233
233
234 $ echo '[hooks]' >> ../remote/.hg/hgrc
234 $ echo '[hooks]' >> ../remote/.hg/hgrc
235 $ echo 'changegroup.stdout = python ../badhook' >> ../remote/.hg/hgrc
235 $ echo 'changegroup.stdout = python ../badhook' >> ../remote/.hg/hgrc
236 $ echo r > r
236 $ echo r > r
237 $ hg ci -A -m z r
237 $ hg ci -A -m z r
238
238
239 push should succeed even though it has an unexpected response
239 push should succeed even though it has an unexpected response
240
240
241 $ hg push
241 $ hg push
242 pushing to ssh://user@dummy/remote
242 pushing to ssh://user@dummy/remote
243 searching for changes
243 searching for changes
244 note: unsynced remote changes!
244 note: unsynced remote changes!
245 remote: adding changesets
245 remote: adding changesets
246 remote: adding manifests
246 remote: adding manifests
247 remote: adding file changes
247 remote: adding file changes
248 remote: added 1 changesets with 1 changes to 1 files
248 remote: added 1 changesets with 1 changes to 1 files
249 remote: KABOOM
249 remote: KABOOM
250 $ hg -R ../remote heads
250 $ hg -R ../remote heads
251 changeset: 3:1383141674ec
251 changeset: 3:1383141674ec
252 tag: tip
252 tag: tip
253 parent: 1:a28a9d1a809c
253 parent: 1:a28a9d1a809c
254 user: test
254 user: test
255 date: Thu Jan 01 00:00:00 1970 +0000
255 date: Thu Jan 01 00:00:00 1970 +0000
256 summary: z
256 summary: z
257
257
258 changeset: 2:6c0482d977a3
258 changeset: 2:6c0482d977a3
259 parent: 0:1160648e36ce
259 parent: 0:1160648e36ce
260 user: test
260 user: test
261 date: Thu Jan 01 00:00:00 1970 +0000
261 date: Thu Jan 01 00:00:00 1970 +0000
262 summary: z
262 summary: z
263
263
264
264
265 clone bookmarks
265 clone bookmarks
266
266
267 $ hg -R ../remote bookmark test
267 $ hg -R ../remote bookmark test
268 $ hg -R ../remote bookmarks
268 $ hg -R ../remote bookmarks
269 * test 2:6c0482d977a3
269 * test 2:6c0482d977a3
270 $ hg clone -e "python ../dummyssh" ssh://user@dummy/remote local-bookmarks
270 $ hg clone -e "python ../dummyssh" ssh://user@dummy/remote local-bookmarks
271 requesting all changes
271 requesting all changes
272 adding changesets
272 adding changesets
273 adding manifests
273 adding manifests
274 adding file changes
274 adding file changes
275 added 4 changesets with 5 changes to 4 files (+1 heads)
275 added 4 changesets with 5 changes to 4 files (+1 heads)
276 updating to branch default
276 updating to branch default
277 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
277 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
278 $ hg -R local-bookmarks bookmarks
278 $ hg -R local-bookmarks bookmarks
279 test 2:6c0482d977a3
279 test 2:6c0482d977a3
280
280
281 passwords in ssh urls are not supported
281 passwords in ssh urls are not supported
282 (we use a glob here because different Python versions give different
282 (we use a glob here because different Python versions give different
283 results here)
283 results here)
284
284
285 $ hg push ssh://user:erroneouspwd@dummy/remote
285 $ hg push ssh://user:erroneouspwd@dummy/remote
286 pushing to ssh://user:*@dummy/remote (glob)
286 pushing to ssh://user:*@dummy/remote (glob)
287 abort: password in URL not supported!
287 abort: password in URL not supported!
288 [255]
288 [255]
289
289
290 $ cd ..
290 $ cd ..
291 $ cat dummylog
291 $ cat dummylog
292 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
292 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
293 Got arguments 1:user@dummy 2:hg -R /$TESTTMP/nonexistent serve --stdio
293 Got arguments 1:user@dummy 2:hg -R /$TESTTMP/nonexistent serve --stdio
294 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
294 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
295 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
295 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
296 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
296 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
297 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
297 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
298 Got arguments 1:user@dummy 2:hg -R local serve --stdio
298 Got arguments 1:user@dummy 2:hg -R local serve --stdio
299 Got arguments 1:user@dummy 2:hg -R $TESTTMP/local serve --stdio
299 Got arguments 1:user@dummy 2:hg -R $TESTTMP/local serve --stdio
300 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
300 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
301 changegroup-in-remote hook: HG_NODE=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1
301 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
302 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
302 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
303 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
303 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
304 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
304 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
305 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
305 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
306 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
306 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
307 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
307 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
308 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
308 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
309 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
309 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
310 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
311 changegroup-in-remote hook: HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1
310 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
312 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
General Comments 0
You need to be logged in to leave comments. Login now