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