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