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