##// END OF EJS Templates
test-ssh: do not actually look up "brokenrepository" by DNS
Yuya Nishihara -
r35172:3180ff7f default
parent child Browse files
Show More
@@ -1,597 +1,596
1
1
2 This test tries to exercise the ssh functionality with a dummy script
2 This test tries to exercise the ssh functionality with a dummy script
3
3
4 $ cat <<EOF >> $HGRCPATH
4 $ cat <<EOF >> $HGRCPATH
5 > [format]
5 > [format]
6 > usegeneraldelta=yes
6 > usegeneraldelta=yes
7 > EOF
7 > EOF
8
8
9 creating 'remote' repo
9 creating 'remote' repo
10
10
11 $ hg init remote
11 $ hg init remote
12 $ cd remote
12 $ cd remote
13 $ echo this > foo
13 $ echo this > foo
14 $ echo this > fooO
14 $ echo this > fooO
15 $ hg ci -A -m "init" foo fooO
15 $ hg ci -A -m "init" foo fooO
16
16
17 insert a closed branch (issue4428)
17 insert a closed branch (issue4428)
18
18
19 $ hg up null
19 $ hg up null
20 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
20 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
21 $ hg branch closed
21 $ hg branch closed
22 marked working directory as branch closed
22 marked working directory as branch closed
23 (branches are permanent and global, did you want a bookmark?)
23 (branches are permanent and global, did you want a bookmark?)
24 $ hg ci -mc0
24 $ hg ci -mc0
25 $ hg ci --close-branch -mc1
25 $ hg ci --close-branch -mc1
26 $ hg up -q default
26 $ hg up -q default
27
27
28 configure for serving
28 configure for serving
29
29
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 = sh -c "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
41 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/nonexistent local
41 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/nonexistent local
42 remote: abort: repository nonexistent not found!
42 remote: abort: repository nonexistent not found!
43 abort: no suitable response from remote hg!
43 abort: no suitable response from remote hg!
44 [255]
44 [255]
45
45
46 non-existent absolute path
46 non-existent absolute path
47
47
48 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/`pwd`/nonexistent local
48 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/`pwd`/nonexistent local
49 remote: abort: repository $TESTTMP/nonexistent not found!
49 remote: abort: repository $TESTTMP/nonexistent not found!
50 abort: no suitable response from remote hg!
50 abort: no suitable response from remote hg!
51 [255]
51 [255]
52
52
53 clone remote via stream
53 clone remote via stream
54
54
55 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/remote local-stream
55 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/remote local-stream
56 streaming all changes
56 streaming all changes
57 4 files to transfer, 602 bytes of data
57 4 files to transfer, 602 bytes of data
58 transferred 602 bytes in * seconds (*) (glob)
58 transferred 602 bytes in * seconds (*) (glob)
59 searching for changes
59 searching for changes
60 no changes found
60 no changes found
61 updating to branch default
61 updating to branch default
62 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
62 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
63 $ cd local-stream
63 $ cd local-stream
64 $ hg verify
64 $ hg verify
65 checking changesets
65 checking changesets
66 checking manifests
66 checking manifests
67 crosschecking files in changesets and manifests
67 crosschecking files in changesets and manifests
68 checking files
68 checking files
69 2 files, 3 changesets, 2 total revisions
69 2 files, 3 changesets, 2 total revisions
70 $ hg branches
70 $ hg branches
71 default 0:1160648e36ce
71 default 0:1160648e36ce
72 $ cd ..
72 $ cd ..
73
73
74 clone bookmarks via stream
74 clone bookmarks via stream
75
75
76 $ hg -R local-stream book mybook
76 $ hg -R local-stream book mybook
77 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/local-stream stream2
77 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/local-stream stream2
78 streaming all changes
78 streaming all changes
79 4 files to transfer, 602 bytes of data
79 4 files to transfer, 602 bytes of data
80 transferred 602 bytes in * seconds (*) (glob)
80 transferred 602 bytes in * seconds (*) (glob)
81 searching for changes
81 searching for changes
82 no changes found
82 no changes found
83 updating to branch default
83 updating to branch default
84 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
84 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
85 $ cd stream2
85 $ cd stream2
86 $ hg book
86 $ hg book
87 mybook 0:1160648e36ce
87 mybook 0:1160648e36ce
88 $ cd ..
88 $ cd ..
89 $ rm -rf local-stream stream2
89 $ rm -rf local-stream stream2
90
90
91 clone remote via pull
91 clone remote via pull
92
92
93 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local
93 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local
94 requesting all changes
94 requesting all changes
95 adding changesets
95 adding changesets
96 adding manifests
96 adding manifests
97 adding file changes
97 adding file changes
98 added 3 changesets with 2 changes to 2 files
98 added 3 changesets with 2 changes to 2 files
99 new changesets 1160648e36ce:ad076bfb429d
99 new changesets 1160648e36ce:ad076bfb429d
100 updating to branch default
100 updating to branch default
101 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
101 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
102
102
103 verify
103 verify
104
104
105 $ cd local
105 $ cd local
106 $ hg verify
106 $ hg verify
107 checking changesets
107 checking changesets
108 checking manifests
108 checking manifests
109 crosschecking files in changesets and manifests
109 crosschecking files in changesets and manifests
110 checking files
110 checking files
111 2 files, 3 changesets, 2 total revisions
111 2 files, 3 changesets, 2 total revisions
112 $ cat >> .hg/hgrc <<EOF
112 $ cat >> .hg/hgrc <<EOF
113 > [hooks]
113 > [hooks]
114 > changegroup = sh -c "printenv.py changegroup-in-local 0 ../dummylog"
114 > changegroup = sh -c "printenv.py changegroup-in-local 0 ../dummylog"
115 > EOF
115 > EOF
116
116
117 empty default pull
117 empty default pull
118
118
119 $ hg paths
119 $ hg paths
120 default = ssh://user@dummy/remote
120 default = ssh://user@dummy/remote
121 $ hg pull -e "\"$PYTHON\" \"$TESTDIR/dummyssh\""
121 $ hg pull -e "\"$PYTHON\" \"$TESTDIR/dummyssh\""
122 pulling from ssh://user@dummy/remote
122 pulling from ssh://user@dummy/remote
123 searching for changes
123 searching for changes
124 no changes found
124 no changes found
125
125
126 pull from wrong ssh URL
126 pull from wrong ssh URL
127
127
128 $ hg pull -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/doesnotexist
128 $ hg pull -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/doesnotexist
129 pulling from ssh://user@dummy/doesnotexist
129 pulling from ssh://user@dummy/doesnotexist
130 remote: abort: repository doesnotexist not found!
130 remote: abort: repository doesnotexist not found!
131 abort: no suitable response from remote hg!
131 abort: no suitable response from remote hg!
132 [255]
132 [255]
133
133
134 local change
134 local change
135
135
136 $ echo bleah > foo
136 $ echo bleah > foo
137 $ hg ci -m "add"
137 $ hg ci -m "add"
138
138
139 updating rc
139 updating rc
140
140
141 $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
141 $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
142 $ echo "[ui]" >> .hg/hgrc
142 $ echo "[ui]" >> .hg/hgrc
143 $ echo "ssh = \"$PYTHON\" \"$TESTDIR/dummyssh\"" >> .hg/hgrc
143 $ echo "ssh = \"$PYTHON\" \"$TESTDIR/dummyssh\"" >> .hg/hgrc
144
144
145 find outgoing
145 find outgoing
146
146
147 $ hg out ssh://user@dummy/remote
147 $ hg out ssh://user@dummy/remote
148 comparing with ssh://user@dummy/remote
148 comparing with ssh://user@dummy/remote
149 searching for changes
149 searching for changes
150 changeset: 3:a28a9d1a809c
150 changeset: 3:a28a9d1a809c
151 tag: tip
151 tag: tip
152 parent: 0:1160648e36ce
152 parent: 0:1160648e36ce
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 find incoming on the remote side
158 find incoming on the remote side
159
159
160 $ hg incoming -R ../remote -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/local
160 $ hg incoming -R ../remote -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/local
161 comparing with ssh://user@dummy/local
161 comparing with ssh://user@dummy/local
162 searching for changes
162 searching for changes
163 changeset: 3:a28a9d1a809c
163 changeset: 3:a28a9d1a809c
164 tag: tip
164 tag: tip
165 parent: 0:1160648e36ce
165 parent: 0:1160648e36ce
166 user: test
166 user: test
167 date: Thu Jan 01 00:00:00 1970 +0000
167 date: Thu Jan 01 00:00:00 1970 +0000
168 summary: add
168 summary: add
169
169
170
170
171 find incoming on the remote side (using absolute path)
171 find incoming on the remote side (using absolute path)
172
172
173 $ hg incoming -R ../remote -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/`pwd`"
173 $ hg incoming -R ../remote -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/`pwd`"
174 comparing with ssh://user@dummy/$TESTTMP/local
174 comparing with ssh://user@dummy/$TESTTMP/local
175 searching for changes
175 searching for changes
176 changeset: 3:a28a9d1a809c
176 changeset: 3:a28a9d1a809c
177 tag: tip
177 tag: tip
178 parent: 0:1160648e36ce
178 parent: 0:1160648e36ce
179 user: test
179 user: test
180 date: Thu Jan 01 00:00:00 1970 +0000
180 date: Thu Jan 01 00:00:00 1970 +0000
181 summary: add
181 summary: add
182
182
183
183
184 push
184 push
185
185
186 $ hg push
186 $ hg push
187 pushing to ssh://user@dummy/remote
187 pushing to ssh://user@dummy/remote
188 searching for changes
188 searching for changes
189 remote: adding changesets
189 remote: adding changesets
190 remote: adding manifests
190 remote: adding manifests
191 remote: adding file changes
191 remote: adding file changes
192 remote: added 1 changesets with 1 changes to 1 files
192 remote: added 1 changesets with 1 changes to 1 files
193 $ cd ../remote
193 $ cd ../remote
194
194
195 check remote tip
195 check remote tip
196
196
197 $ hg tip
197 $ hg tip
198 changeset: 3:a28a9d1a809c
198 changeset: 3:a28a9d1a809c
199 tag: tip
199 tag: tip
200 parent: 0:1160648e36ce
200 parent: 0:1160648e36ce
201 user: test
201 user: test
202 date: Thu Jan 01 00:00:00 1970 +0000
202 date: Thu Jan 01 00:00:00 1970 +0000
203 summary: add
203 summary: add
204
204
205 $ hg verify
205 $ hg verify
206 checking changesets
206 checking changesets
207 checking manifests
207 checking manifests
208 crosschecking files in changesets and manifests
208 crosschecking files in changesets and manifests
209 checking files
209 checking files
210 2 files, 4 changesets, 3 total revisions
210 2 files, 4 changesets, 3 total revisions
211 $ hg cat -r tip foo
211 $ hg cat -r tip foo
212 bleah
212 bleah
213 $ echo z > z
213 $ echo z > z
214 $ hg ci -A -m z z
214 $ hg ci -A -m z z
215 created new head
215 created new head
216
216
217 test pushkeys and bookmarks
217 test pushkeys and bookmarks
218
218
219 $ cd ../local
219 $ cd ../local
220 $ hg debugpushkey --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote namespaces
220 $ hg debugpushkey --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote namespaces
221 bookmarks
221 bookmarks
222 namespaces
222 namespaces
223 phases
223 phases
224 $ hg book foo -r 0
224 $ hg book foo -r 0
225 $ hg out -B
225 $ hg out -B
226 comparing with ssh://user@dummy/remote
226 comparing with ssh://user@dummy/remote
227 searching for changed bookmarks
227 searching for changed bookmarks
228 foo 1160648e36ce
228 foo 1160648e36ce
229 $ hg push -B foo
229 $ hg push -B foo
230 pushing to ssh://user@dummy/remote
230 pushing to ssh://user@dummy/remote
231 searching for changes
231 searching for changes
232 no changes found
232 no changes found
233 exporting bookmark foo
233 exporting bookmark foo
234 [1]
234 [1]
235 $ hg debugpushkey --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote bookmarks
235 $ hg debugpushkey --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote bookmarks
236 foo 1160648e36cec0054048a7edc4110c6f84fde594
236 foo 1160648e36cec0054048a7edc4110c6f84fde594
237 $ hg book -f foo
237 $ hg book -f foo
238 $ hg push --traceback
238 $ hg push --traceback
239 pushing to ssh://user@dummy/remote
239 pushing to ssh://user@dummy/remote
240 searching for changes
240 searching for changes
241 no changes found
241 no changes found
242 updating bookmark foo
242 updating bookmark foo
243 [1]
243 [1]
244 $ hg book -d foo
244 $ hg book -d foo
245 $ hg in -B
245 $ hg in -B
246 comparing with ssh://user@dummy/remote
246 comparing with ssh://user@dummy/remote
247 searching for changed bookmarks
247 searching for changed bookmarks
248 foo a28a9d1a809c
248 foo a28a9d1a809c
249 $ hg book -f -r 0 foo
249 $ hg book -f -r 0 foo
250 $ hg pull -B foo
250 $ hg pull -B foo
251 pulling from ssh://user@dummy/remote
251 pulling from ssh://user@dummy/remote
252 no changes found
252 no changes found
253 updating bookmark foo
253 updating bookmark foo
254 $ hg book -d foo
254 $ hg book -d foo
255 $ hg push -B foo
255 $ hg push -B foo
256 pushing to ssh://user@dummy/remote
256 pushing to ssh://user@dummy/remote
257 searching for changes
257 searching for changes
258 no changes found
258 no changes found
259 deleting remote bookmark foo
259 deleting remote bookmark foo
260 [1]
260 [1]
261
261
262 a bad, evil hook that prints to stdout
262 a bad, evil hook that prints to stdout
263
263
264 $ cat <<EOF > $TESTTMP/badhook
264 $ cat <<EOF > $TESTTMP/badhook
265 > import sys
265 > import sys
266 > sys.stdout.write("KABOOM\n")
266 > sys.stdout.write("KABOOM\n")
267 > EOF
267 > EOF
268
268
269 $ cat <<EOF > $TESTTMP/badpyhook.py
269 $ cat <<EOF > $TESTTMP/badpyhook.py
270 > import sys
270 > import sys
271 > def hook(ui, repo, hooktype, **kwargs):
271 > def hook(ui, repo, hooktype, **kwargs):
272 > sys.stdout.write("KABOOM IN PROCESS\n")
272 > sys.stdout.write("KABOOM IN PROCESS\n")
273 > EOF
273 > EOF
274
274
275 $ cat <<EOF >> ../remote/.hg/hgrc
275 $ cat <<EOF >> ../remote/.hg/hgrc
276 > [hooks]
276 > [hooks]
277 > changegroup.stdout = $PYTHON $TESTTMP/badhook
277 > changegroup.stdout = $PYTHON $TESTTMP/badhook
278 > changegroup.pystdout = python:$TESTTMP/badpyhook.py:hook
278 > changegroup.pystdout = python:$TESTTMP/badpyhook.py:hook
279 > EOF
279 > EOF
280 $ echo r > r
280 $ echo r > r
281 $ hg ci -A -m z r
281 $ hg ci -A -m z r
282
282
283 push should succeed even though it has an unexpected response
283 push should succeed even though it has an unexpected response
284
284
285 $ hg push
285 $ hg push
286 pushing to ssh://user@dummy/remote
286 pushing to ssh://user@dummy/remote
287 searching for changes
287 searching for changes
288 remote has heads on branch 'default' that are not known locally: 6c0482d977a3
288 remote has heads on branch 'default' that are not known locally: 6c0482d977a3
289 remote: adding changesets
289 remote: adding changesets
290 remote: adding manifests
290 remote: adding manifests
291 remote: adding file changes
291 remote: adding file changes
292 remote: added 1 changesets with 1 changes to 1 files
292 remote: added 1 changesets with 1 changes to 1 files
293 remote: KABOOM
293 remote: KABOOM
294 remote: KABOOM IN PROCESS
294 remote: KABOOM IN PROCESS
295 $ hg -R ../remote heads
295 $ hg -R ../remote heads
296 changeset: 5:1383141674ec
296 changeset: 5:1383141674ec
297 tag: tip
297 tag: tip
298 parent: 3:a28a9d1a809c
298 parent: 3:a28a9d1a809c
299 user: test
299 user: test
300 date: Thu Jan 01 00:00:00 1970 +0000
300 date: Thu Jan 01 00:00:00 1970 +0000
301 summary: z
301 summary: z
302
302
303 changeset: 4:6c0482d977a3
303 changeset: 4:6c0482d977a3
304 parent: 0:1160648e36ce
304 parent: 0:1160648e36ce
305 user: test
305 user: test
306 date: Thu Jan 01 00:00:00 1970 +0000
306 date: Thu Jan 01 00:00:00 1970 +0000
307 summary: z
307 summary: z
308
308
309
309
310 clone bookmarks
310 clone bookmarks
311
311
312 $ hg -R ../remote bookmark test
312 $ hg -R ../remote bookmark test
313 $ hg -R ../remote bookmarks
313 $ hg -R ../remote bookmarks
314 * test 4:6c0482d977a3
314 * test 4:6c0482d977a3
315 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local-bookmarks
315 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local-bookmarks
316 requesting all changes
316 requesting all changes
317 adding changesets
317 adding changesets
318 adding manifests
318 adding manifests
319 adding file changes
319 adding file changes
320 added 6 changesets with 5 changes to 4 files (+1 heads)
320 added 6 changesets with 5 changes to 4 files (+1 heads)
321 new changesets 1160648e36ce:1383141674ec
321 new changesets 1160648e36ce:1383141674ec
322 updating to branch default
322 updating to branch default
323 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
323 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
324 $ hg -R local-bookmarks bookmarks
324 $ hg -R local-bookmarks bookmarks
325 test 4:6c0482d977a3
325 test 4:6c0482d977a3
326
326
327 passwords in ssh urls are not supported
327 passwords in ssh urls are not supported
328 (we use a glob here because different Python versions give different
328 (we use a glob here because different Python versions give different
329 results here)
329 results here)
330
330
331 $ hg push ssh://user:erroneouspwd@dummy/remote
331 $ hg push ssh://user:erroneouspwd@dummy/remote
332 pushing to ssh://user:*@dummy/remote (glob)
332 pushing to ssh://user:*@dummy/remote (glob)
333 abort: password in URL not supported!
333 abort: password in URL not supported!
334 [255]
334 [255]
335
335
336 $ cd ..
336 $ cd ..
337
337
338 hide outer repo
338 hide outer repo
339 $ hg init
339 $ hg init
340
340
341 Test remote paths with spaces (issue2983):
341 Test remote paths with spaces (issue2983):
342
342
343 $ hg init --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
343 $ hg init --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
344 $ touch "$TESTTMP/a repo/test"
344 $ touch "$TESTTMP/a repo/test"
345 $ hg -R 'a repo' commit -A -m "test"
345 $ hg -R 'a repo' commit -A -m "test"
346 adding test
346 adding test
347 $ hg -R 'a repo' tag tag
347 $ hg -R 'a repo' tag tag
348 $ hg id --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
348 $ hg id --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
349 73649e48688a
349 73649e48688a
350
350
351 $ hg id --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo#noNoNO"
351 $ hg id --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo#noNoNO"
352 abort: unknown revision 'noNoNO'!
352 abort: unknown revision 'noNoNO'!
353 [255]
353 [255]
354
354
355 Test (non-)escaping of remote paths with spaces when cloning (issue3145):
355 Test (non-)escaping of remote paths with spaces when cloning (issue3145):
356
356
357 $ hg clone --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
357 $ hg clone --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
358 destination directory: a repo
358 destination directory: a repo
359 abort: destination 'a repo' is not empty
359 abort: destination 'a repo' is not empty
360 [255]
360 [255]
361
361
362 Make sure hg is really paranoid in serve --stdio mode. It used to be
362 Make sure hg is really paranoid in serve --stdio mode. It used to be
363 possible to get a debugger REPL by specifying a repo named --debugger.
363 possible to get a debugger REPL by specifying a repo named --debugger.
364 $ hg -R --debugger serve --stdio
364 $ hg -R --debugger serve --stdio
365 abort: potentially unsafe serve --stdio invocation: ['-R', '--debugger', 'serve', '--stdio']
365 abort: potentially unsafe serve --stdio invocation: ['-R', '--debugger', 'serve', '--stdio']
366 [255]
366 [255]
367 $ hg -R --config=ui.debugger=yes serve --stdio
367 $ hg -R --config=ui.debugger=yes serve --stdio
368 abort: potentially unsafe serve --stdio invocation: ['-R', '--config=ui.debugger=yes', 'serve', '--stdio']
368 abort: potentially unsafe serve --stdio invocation: ['-R', '--config=ui.debugger=yes', 'serve', '--stdio']
369 [255]
369 [255]
370 Abbreviations of 'serve' also don't work, to avoid shenanigans.
370 Abbreviations of 'serve' also don't work, to avoid shenanigans.
371 $ hg -R narf serv --stdio
371 $ hg -R narf serv --stdio
372 abort: potentially unsafe serve --stdio invocation: ['-R', 'narf', 'serv', '--stdio']
372 abort: potentially unsafe serve --stdio invocation: ['-R', 'narf', 'serv', '--stdio']
373 [255]
373 [255]
374
374
375 Test hg-ssh using a helper script that will restore PYTHONPATH (which might
375 Test hg-ssh using a helper script that will restore PYTHONPATH (which might
376 have been cleared by a hg.exe wrapper) and invoke hg-ssh with the right
376 have been cleared by a hg.exe wrapper) and invoke hg-ssh with the right
377 parameters:
377 parameters:
378
378
379 $ cat > ssh.sh << EOF
379 $ cat > ssh.sh << EOF
380 > userhost="\$1"
380 > userhost="\$1"
381 > SSH_ORIGINAL_COMMAND="\$2"
381 > SSH_ORIGINAL_COMMAND="\$2"
382 > export SSH_ORIGINAL_COMMAND
382 > export SSH_ORIGINAL_COMMAND
383 > PYTHONPATH="$PYTHONPATH"
383 > PYTHONPATH="$PYTHONPATH"
384 > export PYTHONPATH
384 > export PYTHONPATH
385 > "$PYTHON" "$TESTDIR/../contrib/hg-ssh" "$TESTTMP/a repo"
385 > "$PYTHON" "$TESTDIR/../contrib/hg-ssh" "$TESTTMP/a repo"
386 > EOF
386 > EOF
387
387
388 $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a repo"
388 $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a repo"
389 73649e48688a
389 73649e48688a
390
390
391 $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a'repo"
391 $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a'repo"
392 remote: Illegal repository "$TESTTMP/a'repo" (glob)
392 remote: Illegal repository "$TESTTMP/a'repo" (glob)
393 abort: no suitable response from remote hg!
393 abort: no suitable response from remote hg!
394 [255]
394 [255]
395
395
396 $ hg id --ssh "sh ssh.sh" --remotecmd hacking "ssh://user@dummy/a'repo"
396 $ hg id --ssh "sh ssh.sh" --remotecmd hacking "ssh://user@dummy/a'repo"
397 remote: Illegal command "hacking -R 'a'\''repo' serve --stdio"
397 remote: Illegal command "hacking -R 'a'\''repo' serve --stdio"
398 abort: no suitable response from remote hg!
398 abort: no suitable response from remote hg!
399 [255]
399 [255]
400
400
401 $ SSH_ORIGINAL_COMMAND="'hg' -R 'a'repo' serve --stdio" $PYTHON "$TESTDIR/../contrib/hg-ssh"
401 $ SSH_ORIGINAL_COMMAND="'hg' -R 'a'repo' serve --stdio" $PYTHON "$TESTDIR/../contrib/hg-ssh"
402 Illegal command "'hg' -R 'a'repo' serve --stdio": No closing quotation
402 Illegal command "'hg' -R 'a'repo' serve --stdio": No closing quotation
403 [255]
403 [255]
404
404
405 Test hg-ssh in read-only mode:
405 Test hg-ssh in read-only mode:
406
406
407 $ cat > ssh.sh << EOF
407 $ cat > ssh.sh << EOF
408 > userhost="\$1"
408 > userhost="\$1"
409 > SSH_ORIGINAL_COMMAND="\$2"
409 > SSH_ORIGINAL_COMMAND="\$2"
410 > export SSH_ORIGINAL_COMMAND
410 > export SSH_ORIGINAL_COMMAND
411 > PYTHONPATH="$PYTHONPATH"
411 > PYTHONPATH="$PYTHONPATH"
412 > export PYTHONPATH
412 > export PYTHONPATH
413 > "$PYTHON" "$TESTDIR/../contrib/hg-ssh" --read-only "$TESTTMP/remote"
413 > "$PYTHON" "$TESTDIR/../contrib/hg-ssh" --read-only "$TESTTMP/remote"
414 > EOF
414 > EOF
415
415
416 $ hg clone --ssh "sh ssh.sh" "ssh://user@dummy/$TESTTMP/remote" read-only-local
416 $ hg clone --ssh "sh ssh.sh" "ssh://user@dummy/$TESTTMP/remote" read-only-local
417 requesting all changes
417 requesting all changes
418 adding changesets
418 adding changesets
419 adding manifests
419 adding manifests
420 adding file changes
420 adding file changes
421 added 6 changesets with 5 changes to 4 files (+1 heads)
421 added 6 changesets with 5 changes to 4 files (+1 heads)
422 new changesets 1160648e36ce:1383141674ec
422 new changesets 1160648e36ce:1383141674ec
423 updating to branch default
423 updating to branch default
424 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
424 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
425
425
426 $ cd read-only-local
426 $ cd read-only-local
427 $ echo "baz" > bar
427 $ echo "baz" > bar
428 $ hg ci -A -m "unpushable commit" bar
428 $ hg ci -A -m "unpushable commit" bar
429 $ hg push --ssh "sh ../ssh.sh"
429 $ hg push --ssh "sh ../ssh.sh"
430 pushing to ssh://user@dummy/*/remote (glob)
430 pushing to ssh://user@dummy/*/remote (glob)
431 searching for changes
431 searching for changes
432 remote: Permission denied
432 remote: Permission denied
433 remote: pretxnopen.hg-ssh hook failed
433 remote: pretxnopen.hg-ssh hook failed
434 abort: push failed on remote
434 abort: push failed on remote
435 [255]
435 [255]
436
436
437 $ cd ..
437 $ cd ..
438
438
439 stderr from remote commands should be printed before stdout from local code (issue4336)
439 stderr from remote commands should be printed before stdout from local code (issue4336)
440
440
441 $ hg clone remote stderr-ordering
441 $ hg clone remote stderr-ordering
442 updating to branch default
442 updating to branch default
443 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
443 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
444 $ cd stderr-ordering
444 $ cd stderr-ordering
445 $ cat >> localwrite.py << EOF
445 $ cat >> localwrite.py << EOF
446 > from mercurial import exchange, extensions
446 > from mercurial import exchange, extensions
447 >
447 >
448 > def wrappedpush(orig, repo, *args, **kwargs):
448 > def wrappedpush(orig, repo, *args, **kwargs):
449 > res = orig(repo, *args, **kwargs)
449 > res = orig(repo, *args, **kwargs)
450 > repo.ui.write('local stdout\n')
450 > repo.ui.write('local stdout\n')
451 > return res
451 > return res
452 >
452 >
453 > def extsetup(ui):
453 > def extsetup(ui):
454 > extensions.wrapfunction(exchange, 'push', wrappedpush)
454 > extensions.wrapfunction(exchange, 'push', wrappedpush)
455 > EOF
455 > EOF
456
456
457 $ cat >> .hg/hgrc << EOF
457 $ cat >> .hg/hgrc << EOF
458 > [paths]
458 > [paths]
459 > default-push = ssh://user@dummy/remote
459 > default-push = ssh://user@dummy/remote
460 > [ui]
460 > [ui]
461 > ssh = "$PYTHON" "$TESTDIR/dummyssh"
461 > ssh = "$PYTHON" "$TESTDIR/dummyssh"
462 > [extensions]
462 > [extensions]
463 > localwrite = localwrite.py
463 > localwrite = localwrite.py
464 > EOF
464 > EOF
465
465
466 $ echo localwrite > foo
466 $ echo localwrite > foo
467 $ hg commit -m 'testing localwrite'
467 $ hg commit -m 'testing localwrite'
468 $ hg push
468 $ hg push
469 pushing to ssh://user@dummy/remote
469 pushing to ssh://user@dummy/remote
470 searching for changes
470 searching for changes
471 remote: adding changesets
471 remote: adding changesets
472 remote: adding manifests
472 remote: adding manifests
473 remote: adding file changes
473 remote: adding file changes
474 remote: added 1 changesets with 1 changes to 1 files
474 remote: added 1 changesets with 1 changes to 1 files
475 remote: KABOOM
475 remote: KABOOM
476 remote: KABOOM IN PROCESS
476 remote: KABOOM IN PROCESS
477 local stdout
477 local stdout
478
478
479 debug output
479 debug output
480
480
481 $ hg pull --debug ssh://user@dummy/remote
481 $ hg pull --debug ssh://user@dummy/remote
482 pulling from ssh://user@dummy/remote
482 pulling from ssh://user@dummy/remote
483 running .* ".*/dummyssh" ['"]user@dummy['"] ('|")hg -R remote serve --stdio('|") (re)
483 running .* ".*/dummyssh" ['"]user@dummy['"] ('|")hg -R remote serve --stdio('|") (re)
484 sending hello command
484 sending hello command
485 sending between command
485 sending between command
486 remote: 372
486 remote: 372
487 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS$ unbundle=HG10GZ,HG10BZ,HG10UN
487 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS$ unbundle=HG10GZ,HG10BZ,HG10UN
488 remote: 1
488 remote: 1
489 query 1; heads
489 query 1; heads
490 sending batch command
490 sending batch command
491 searching for changes
491 searching for changes
492 all remote heads known locally
492 all remote heads known locally
493 no changes found
493 no changes found
494 sending getbundle command
494 sending getbundle command
495 bundle2-input-bundle: with-transaction
495 bundle2-input-bundle: with-transaction
496 bundle2-input-part: "listkeys" (params: 1 mandatory) supported
496 bundle2-input-part: "listkeys" (params: 1 mandatory) supported
497 bundle2-input-part: total payload size 45
497 bundle2-input-part: total payload size 45
498 bundle2-input-part: "phase-heads" supported
498 bundle2-input-part: "phase-heads" supported
499 bundle2-input-part: total payload size 72
499 bundle2-input-part: total payload size 72
500 bundle2-input-bundle: 1 parts total
500 bundle2-input-bundle: 1 parts total
501 checking for updated bookmarks
501 checking for updated bookmarks
502
502
503 $ cd ..
503 $ cd ..
504
504
505 $ cat dummylog
505 $ cat dummylog
506 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
506 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
507 Got arguments 1:user@dummy 2:hg -R $TESTTMP/nonexistent serve --stdio
507 Got arguments 1:user@dummy 2:hg -R $TESTTMP/nonexistent serve --stdio
508 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
508 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
509 Got arguments 1:user@dummy 2:hg -R local-stream serve --stdio
509 Got arguments 1:user@dummy 2:hg -R local-stream serve --stdio
510 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
510 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
511 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
511 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
512 Got arguments 1:user@dummy 2:hg -R doesnotexist serve --stdio
512 Got arguments 1:user@dummy 2:hg -R doesnotexist serve --stdio
513 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
513 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
514 Got arguments 1:user@dummy 2:hg -R local serve --stdio
514 Got arguments 1:user@dummy 2:hg -R local serve --stdio
515 Got arguments 1:user@dummy 2:hg -R $TESTTMP/local serve --stdio
515 Got arguments 1:user@dummy 2:hg -R $TESTTMP/local serve --stdio
516 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
516 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
517 changegroup-in-remote hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 HG_NODE_LAST=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:ssh:$LOCALIP
517 changegroup-in-remote hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 HG_NODE_LAST=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:ssh:$LOCALIP
518 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
518 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
519 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
519 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
520 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
520 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
521 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
521 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
522 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
522 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
523 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
523 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
524 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
524 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
525 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
525 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
526 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
526 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
527 changegroup-in-remote hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 HG_NODE_LAST=1383141674ec756a6056f6a9097618482fe0f4a6 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:ssh:$LOCALIP
527 changegroup-in-remote hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 HG_NODE_LAST=1383141674ec756a6056f6a9097618482fe0f4a6 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:ssh:$LOCALIP
528 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
528 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
529 Got arguments 1:user@dummy 2:hg init 'a repo'
529 Got arguments 1:user@dummy 2:hg init 'a repo'
530 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
530 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
531 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
531 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
532 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
532 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
533 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
533 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
534 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
534 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
535 changegroup-in-remote hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=65c38f4125f9602c8db4af56530cc221d93b8ef8 HG_NODE_LAST=65c38f4125f9602c8db4af56530cc221d93b8ef8 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:ssh:$LOCALIP
535 changegroup-in-remote hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=65c38f4125f9602c8db4af56530cc221d93b8ef8 HG_NODE_LAST=65c38f4125f9602c8db4af56530cc221d93b8ef8 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:ssh:$LOCALIP
536 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
536 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
537
537
538 remote hook failure is attributed to remote
538 remote hook failure is attributed to remote
539
539
540 $ cat > $TESTTMP/failhook << EOF
540 $ cat > $TESTTMP/failhook << EOF
541 > def hook(ui, repo, **kwargs):
541 > def hook(ui, repo, **kwargs):
542 > ui.write('hook failure!\n')
542 > ui.write('hook failure!\n')
543 > ui.flush()
543 > ui.flush()
544 > return 1
544 > return 1
545 > EOF
545 > EOF
546
546
547 $ echo "pretxnchangegroup.fail = python:$TESTTMP/failhook:hook" >> remote/.hg/hgrc
547 $ echo "pretxnchangegroup.fail = python:$TESTTMP/failhook:hook" >> remote/.hg/hgrc
548
548
549 $ hg -q --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" clone ssh://user@dummy/remote hookout
549 $ hg -q --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" clone ssh://user@dummy/remote hookout
550 $ cd hookout
550 $ cd hookout
551 $ touch hookfailure
551 $ touch hookfailure
552 $ hg -q commit -A -m 'remote hook failure'
552 $ hg -q commit -A -m 'remote hook failure'
553 $ hg --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" push
553 $ hg --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" push
554 pushing to ssh://user@dummy/remote
554 pushing to ssh://user@dummy/remote
555 searching for changes
555 searching for changes
556 remote: adding changesets
556 remote: adding changesets
557 remote: adding manifests
557 remote: adding manifests
558 remote: adding file changes
558 remote: adding file changes
559 remote: added 1 changesets with 1 changes to 1 files
559 remote: added 1 changesets with 1 changes to 1 files
560 remote: hook failure!
560 remote: hook failure!
561 remote: transaction abort!
561 remote: transaction abort!
562 remote: rollback completed
562 remote: rollback completed
563 remote: pretxnchangegroup.fail hook failed
563 remote: pretxnchangegroup.fail hook failed
564 abort: push failed on remote
564 abort: push failed on remote
565 [255]
565 [255]
566
566
567 abort during pull is properly reported as such
567 abort during pull is properly reported as such
568
568
569 $ echo morefoo >> ../remote/foo
569 $ echo morefoo >> ../remote/foo
570 $ hg -R ../remote commit --message "more foo to be pulled"
570 $ hg -R ../remote commit --message "more foo to be pulled"
571 $ cat >> ../remote/.hg/hgrc << EOF
571 $ cat >> ../remote/.hg/hgrc << EOF
572 > [extensions]
572 > [extensions]
573 > crash = ${TESTDIR}/crashgetbundler.py
573 > crash = ${TESTDIR}/crashgetbundler.py
574 > EOF
574 > EOF
575 $ hg --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" pull
575 $ hg --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" pull
576 pulling from ssh://user@dummy/remote
576 pulling from ssh://user@dummy/remote
577 searching for changes
577 searching for changes
578 remote: abort: this is an exercise
578 remote: abort: this is an exercise
579 abort: pull failed on remote
579 abort: pull failed on remote
580 [255]
580 [255]
581
581
582 abort with no error hint when there is a ssh problem when pulling
582 abort with no error hint when there is a ssh problem when pulling
583
583
584 $ hg pull ssh://brokenrepository
584 $ hg pull ssh://brokenrepository -e "\"$PYTHON\" \"$TESTDIR/dummyssh\""
585 pulling from ssh://brokenrepository/
585 pulling from ssh://brokenrepository/
586 remote: ssh: Could not resolve hostname brokenrepository: Name or service not known
587 abort: no suitable response from remote hg!
586 abort: no suitable response from remote hg!
588 [255]
587 [255]
589
588
590 abort with configured error hint when there is a ssh problem when pulling
589 abort with configured error hint when there is a ssh problem when pulling
591
590
592 $ hg pull ssh://brokenrepository --config ui.ssherrorhint="Please see http://company/internalwiki/ssh.html"
591 $ hg pull ssh://brokenrepository -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" \
592 > --config ui.ssherrorhint="Please see http://company/internalwiki/ssh.html"
593 pulling from ssh://brokenrepository/
593 pulling from ssh://brokenrepository/
594 remote: ssh: Could not resolve hostname brokenrepository: Name or service not known
595 abort: no suitable response from remote hg!
594 abort: no suitable response from remote hg!
596 (Please see http://company/internalwiki/ssh.html)
595 (Please see http://company/internalwiki/ssh.html)
597 [255]
596 [255]
General Comments 0
You need to be logged in to leave comments. Login now