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