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