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