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