Debian Codegraph @

tests/test-ssh-proto-unbundle.t

raw
1 persistent-nodemap is not enabled by default. It is not relevant for this test so disable it.
2
3 $ cat << EOF >> $HGRCPATH
4 > [format]
5 > use-persistent-nodemap = no
6 > EOF
7
8 $ debugwireproto() {
9 > commands=`cat -`
10 > echo 'testing ssh1'
11 > tip=`hg log -r tip -T '{node}'`
12 > echo "${commands}" | hg --verbose debugwireproto --localssh --noreadstderr
13 > if [ -n "$1" ]; then
14 > hg --config extensions.strip= strip --no-backup -r "all() - ::${tip}"
15 > fi
16 > }
17
18 Generate some bundle files
19
20 $ hg init repo
21 $ cd repo
22 $ echo 0 > foo
23 $ hg -q commit -A -m initial
24 $ hg bundle --all -t none-v1 ../initial.v1.hg
25 1 changesets found
26 $ cd ..
27
28 Test pushing bundle1 payload to a server with bundle1 disabled
29
30 $ hg init no-bundle1
31 $ cd no-bundle1
32 $ cat > .hg/hgrc << EOF
33 > [server]
34 > bundle1 = false
35 > EOF
36
37 $ debugwireproto << EOF
38 > command unbundle
39 > # This is "force" in hex.
40 > heads 666f726365
41 > PUSHFILE ../initial.v1.hg
42 > readavailable
43 > EOF
44 testing ssh1
45 creating ssh peer from handshake results
46 i> write(104) -> 104:
47 i> hello\n
48 i> between\n
49 i> pairs 81\n
50 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
51 i> flush() -> None
52 o> readline() -> 4:
53 o> \d+\\n (re)
54 o> readline\(\) -> \d+: (re)
55 o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re)
56 o> readline() -> 2:
57 o> 1\n
58 o> readline() -> 1:
59 o> \n
60 sending unbundle command
61 i> write(9) -> 9:
62 i> unbundle\n
63 i> write(9) -> 9:
64 i> heads 10\n
65 i> write(10) -> 10: 666f726365
66 i> flush() -> None
67 o> readline() -> 2:
68 o> 0\n
69 i> write(4) -> 4:
70 i> 426\n
71 i> write(426) -> 426:
72 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
73 i> test\n
74 i> 0 0\n
75 i> foo\n
76 i> \n
77 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
78 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
79 i> \x00\x00\x00\x00\x00\x00\x00\x00
80 i> write(2) -> 2:
81 i> 0\n
82 i> flush() -> None
83 o> readline() -> 2:
84 o> 0\n
85 o> readline() -> 2:
86 o> 1\n
87 o> read(1) -> 1: 0
88 result: 0
89 remote output:
90 e> read(-1) -> 115:
91 e> abort: incompatible Mercurial client; bundle2 required\n
92 e> (see https://www.mercurial-scm.org/wiki/IncompatibleClient)\n
93
94 $ cd ..
95
96 Create a pretxnchangegroup hook that fails. Give it multiple modes of printing
97 output so we can test I/O capture and behavior.
98
99 Test pushing to a server that has a pretxnchangegroup Python hook that fails
100
101 $ cat > $TESTTMP/failhook << EOF
102 > import sys
103 > def hook1line(ui, repo, **kwargs):
104 > ui.write(b'ui.write 1 line\n')
105 > ui.flush()
106 > return 1
107 > def hook2lines(ui, repo, **kwargs):
108 > ui.write(b'ui.write 2 lines 1\n')
109 > ui.write(b'ui.write 2 lines 2\n')
110 > ui.flush()
111 > return 1
112 > def hook1lineflush(ui, repo, **kwargs):
113 > ui.write(b'ui.write 1 line flush\n')
114 > ui.flush()
115 > return 1
116 > def hookmultiflush(ui, repo, **kwargs):
117 > ui.write(b'ui.write 1st\n')
118 > ui.flush()
119 > ui.write(b'ui.write 2nd\n')
120 > ui.flush()
121 > return 1
122 > def hookwriteandwriteerr(ui, repo, **kwargs):
123 > ui.write(b'ui.write 1\n')
124 > ui.write_err(b'ui.write_err 1\n')
125 > ui.write(b'ui.write 2\n')
126 > ui.write_err(b'ui.write_err 2\n')
127 > ui.flush()
128 > return 1
129 > def hookprintstdout(ui, repo, **kwargs):
130 > print('printed line')
131 > sys.stdout.flush()
132 > return 1
133 > def hookprintandwrite(ui, repo, **kwargs):
134 > print('print 1')
135 > sys.stdout.flush()
136 > ui.write(b'ui.write 1\n')
137 > ui.flush()
138 > print('print 2')
139 > sys.stdout.flush()
140 > ui.write(b'ui.write 2\n')
141 > ui.flush()
142 > return 1
143 > def hookprintstderrandstdout(ui, repo, **kwargs):
144 > print('stdout 1')
145 > sys.stdout.flush()
146 > print('stderr 1', file=sys.stderr)
147 > sys.stderr.flush()
148 > print('stdout 2')
149 > sys.stdout.flush()
150 > print('stderr 2', file=sys.stderr)
151 > sys.stderr.flush()
152 > return 1
153 > EOF
154
155 $ hg init failrepo
156 $ cd failrepo
157
158 ui.write() in hook is redirected to stderr
159
160 $ cat > .hg/hgrc << EOF
161 > [hooks]
162 > pretxnchangegroup.fail = python:$TESTTMP/failhook:hook1line
163 > EOF
164
165 $ debugwireproto << EOF
166 > command unbundle
167 > # This is "force" in hex.
168 > heads 666f726365
169 > PUSHFILE ../initial.v1.hg
170 > readavailable
171 > EOF
172 testing ssh1
173 creating ssh peer from handshake results
174 i> write(104) -> 104:
175 i> hello\n
176 i> between\n
177 i> pairs 81\n
178 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
179 i> flush() -> None
180 o> readline() -> 4:
181 o> \d+\\n (re)
182 o> readline\(\) -> \d+: (re)
183 o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re)
184 o> readline() -> 2:
185 o> 1\n
186 o> readline() -> 1:
187 o> \n
188 sending unbundle command
189 i> write(9) -> 9:
190 i> unbundle\n
191 i> write(9) -> 9:
192 i> heads 10\n
193 i> write(10) -> 10: 666f726365
194 i> flush() -> None
195 o> readline() -> 2:
196 o> 0\n
197 i> write(4) -> 4:
198 i> 426\n
199 i> write(426) -> 426:
200 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
201 i> test\n
202 i> 0 0\n
203 i> foo\n
204 i> \n
205 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
206 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
207 i> \x00\x00\x00\x00\x00\x00\x00\x00
208 i> write(2) -> 2:
209 i> 0\n
210 i> flush() -> None
211 o> readline() -> 2:
212 o> 0\n
213 o> readline() -> 2:
214 o> 1\n
215 o> read(1) -> 1: 0
216 result: 0
217 remote output:
218 e> read(-1) -> 151:
219 e> adding changesets\n
220 e> adding manifests\n
221 e> adding file changes\n
222 e> ui.write 1 line\n
223 e> transaction abort!\n
224 e> rollback completed\n
225 e> abort: pretxnchangegroup.fail hook failed\n
226
227 And a variation that writes multiple lines using ui.write
228
229 $ cat > .hg/hgrc << EOF
230 > [hooks]
231 > pretxnchangegroup.fail = python:$TESTTMP/failhook:hook2lines
232 > EOF
233
234 $ debugwireproto << EOF
235 > command unbundle
236 > # This is "force" in hex.
237 > heads 666f726365
238 > PUSHFILE ../initial.v1.hg
239 > readavailable
240 > EOF
241 testing ssh1
242 creating ssh peer from handshake results
243 i> write(104) -> 104:
244 i> hello\n
245 i> between\n
246 i> pairs 81\n
247 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
248 i> flush() -> None
249 o> readline\(\) -> \d+: (re)
250 o> \d+\\n (re)
251 o> readline\(\) -> \d+: (re)
252 o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re)
253 o> readline() -> 2:
254 o> 1\n
255 o> readline() -> 1:
256 o> \n
257 sending unbundle command
258 i> write(9) -> 9:
259 i> unbundle\n
260 i> write(9) -> 9:
261 i> heads 10\n
262 i> write(10) -> 10: 666f726365
263 i> flush() -> None
264 o> readline() -> 2:
265 o> 0\n
266 i> write(4) -> 4:
267 i> 426\n
268 i> write(426) -> 426:
269 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
270 i> test\n
271 i> 0 0\n
272 i> foo\n
273 i> \n
274 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
275 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
276 i> \x00\x00\x00\x00\x00\x00\x00\x00
277 i> write(2) -> 2:
278 i> 0\n
279 i> flush() -> None
280 o> readline() -> 2:
281 o> 0\n
282 o> readline() -> 2:
283 o> 1\n
284 o> read(1) -> 1: 0
285 result: 0
286 remote output:
287 e> read(-1) -> 173:
288 e> adding changesets\n
289 e> adding manifests\n
290 e> adding file changes\n
291 e> ui.write 2 lines 1\n
292 e> ui.write 2 lines 2\n
293 e> transaction abort!\n
294 e> rollback completed\n
295 e> abort: pretxnchangegroup.fail hook failed\n
296
297 And a variation that does a ui.flush() after writing output
298
299 $ cat > .hg/hgrc << EOF
300 > [hooks]
301 > pretxnchangegroup.fail = python:$TESTTMP/failhook:hook1lineflush
302 > EOF
303
304 $ debugwireproto << EOF
305 > command unbundle
306 > # This is "force" in hex.
307 > heads 666f726365
308 > PUSHFILE ../initial.v1.hg
309 > readavailable
310 > EOF
311 testing ssh1
312 creating ssh peer from handshake results
313 i> write(104) -> 104:
314 i> hello\n
315 i> between\n
316 i> pairs 81\n
317 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
318 i> flush() -> None
319 o> readline() -> 4:
320 o> \d+\\n (re)
321 o> readline\(\) -> \d+: (re)
322 o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re)
323 o> readline() -> 2:
324 o> 1\n
325 o> readline() -> 1:
326 o> \n
327 sending unbundle command
328 i> write(9) -> 9:
329 i> unbundle\n
330 i> write(9) -> 9:
331 i> heads 10\n
332 i> write(10) -> 10: 666f726365
333 i> flush() -> None
334 o> readline() -> 2:
335 o> 0\n
336 i> write(4) -> 4:
337 i> 426\n
338 i> write(426) -> 426:
339 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
340 i> test\n
341 i> 0 0\n
342 i> foo\n
343 i> \n
344 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
345 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
346 i> \x00\x00\x00\x00\x00\x00\x00\x00
347 i> write(2) -> 2:
348 i> 0\n
349 i> flush() -> None
350 o> readline() -> 2:
351 o> 0\n
352 o> readline() -> 2:
353 o> 1\n
354 o> read(1) -> 1: 0
355 result: 0
356 remote output:
357 e> read(-1) -> 157:
358 e> adding changesets\n
359 e> adding manifests\n
360 e> adding file changes\n
361 e> ui.write 1 line flush\n
362 e> transaction abort!\n
363 e> rollback completed\n
364 e> abort: pretxnchangegroup.fail hook failed\n
365
366 Multiple writes + flush
367
368 $ cat > .hg/hgrc << EOF
369 > [hooks]
370 > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookmultiflush
371 > EOF
372
373 $ debugwireproto << EOF
374 > command unbundle
375 > # This is "force" in hex.
376 > heads 666f726365
377 > PUSHFILE ../initial.v1.hg
378 > readavailable
379 > EOF
380 testing ssh1
381 creating ssh peer from handshake results
382 i> write(104) -> 104:
383 i> hello\n
384 i> between\n
385 i> pairs 81\n
386 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
387 i> flush() -> None
388 o> readline() -> 4:
389 o> \d+\\n (re)
390 o> readline\(\) -> \d+: (re)
391 o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re)
392 o> readline() -> 2:
393 o> 1\n
394 o> readline() -> 1:
395 o> \n
396 sending unbundle command
397 i> write(9) -> 9:
398 i> unbundle\n
399 i> write(9) -> 9:
400 i> heads 10\n
401 i> write(10) -> 10: 666f726365
402 i> flush() -> None
403 o> readline() -> 2:
404 o> 0\n
405 i> write(4) -> 4:
406 i> 426\n
407 i> write(426) -> 426:
408 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
409 i> test\n
410 i> 0 0\n
411 i> foo\n
412 i> \n
413 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
414 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
415 i> \x00\x00\x00\x00\x00\x00\x00\x00
416 i> write(2) -> 2:
417 i> 0\n
418 i> flush() -> None
419 o> readline() -> 2:
420 o> 0\n
421 o> readline() -> 2:
422 o> 1\n
423 o> read(1) -> 1: 0
424 result: 0
425 remote output:
426 e> read(-1) -> 161:
427 e> adding changesets\n
428 e> adding manifests\n
429 e> adding file changes\n
430 e> ui.write 1st\n
431 e> ui.write 2nd\n
432 e> transaction abort!\n
433 e> rollback completed\n
434 e> abort: pretxnchangegroup.fail hook failed\n
435
436 ui.write() + ui.write_err() output is captured
437
438 $ cat > .hg/hgrc << EOF
439 > [hooks]
440 > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookwriteandwriteerr
441 > EOF
442
443 $ debugwireproto << EOF
444 > command unbundle
445 > # This is "force" in hex.
446 > heads 666f726365
447 > PUSHFILE ../initial.v1.hg
448 > readavailable
449 > EOF
450 testing ssh1
451 creating ssh peer from handshake results
452 i> write(104) -> 104:
453 i> hello\n
454 i> between\n
455 i> pairs 81\n
456 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
457 i> flush() -> None
458 o> readline() -> 4:
459 o> \d+\\n (re)
460 o> readline\(\) -> \d+: (re)
461 o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re)
462 o> readline() -> 2:
463 o> 1\n
464 o> readline() -> 1:
465 o> \n
466 sending unbundle command
467 i> write(9) -> 9:
468 i> unbundle\n
469 i> write(9) -> 9:
470 i> heads 10\n
471 i> write(10) -> 10: 666f726365
472 i> flush() -> None
473 o> readline() -> 2:
474 o> 0\n
475 i> write(4) -> 4:
476 i> 426\n
477 i> write(426) -> 426:
478 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
479 i> test\n
480 i> 0 0\n
481 i> foo\n
482 i> \n
483 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
484 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
485 i> \x00\x00\x00\x00\x00\x00\x00\x00
486 i> write(2) -> 2:
487 i> 0\n
488 i> flush() -> None
489 o> readline() -> 2:
490 o> 0\n
491 o> readline() -> 2:
492 o> 1\n
493 o> read(1) -> 1: 0
494 result: 0
495 remote output:
496 e> read(-1) -> 187:
497 e> adding changesets\n
498 e> adding manifests\n
499 e> adding file changes\n
500 e> ui.write 1\n
501 e> ui.write_err 1\n
502 e> ui.write 2\n
503 e> ui.write_err 2\n
504 e> transaction abort!\n
505 e> rollback completed\n
506 e> abort: pretxnchangegroup.fail hook failed\n
507
508
509 print() output is captured
510
511 $ cat > .hg/hgrc << EOF
512 > [hooks]
513 > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookprintstdout
514 > EOF
515
516 $ debugwireproto << EOF
517 > command unbundle
518 > # This is "force" in hex.
519 > heads 666f726365
520 > PUSHFILE ../initial.v1.hg
521 > readavailable
522 > EOF
523 testing ssh1
524 creating ssh peer from handshake results
525 i> write(104) -> 104:
526 i> hello\n
527 i> between\n
528 i> pairs 81\n
529 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
530 i> flush() -> None
531 o> readline() -> 4:
532 o> \d+\\n (re)
533 o> readline\(\) -> \d+: (re)
534 o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re)
535 o> readline() -> 2:
536 o> 1\n
537 o> readline() -> 1:
538 o> \n
539 sending unbundle command
540 i> write(9) -> 9:
541 i> unbundle\n
542 i> write(9) -> 9:
543 i> heads 10\n
544 i> write(10) -> 10: 666f726365
545 i> flush() -> None
546 o> readline() -> 2:
547 o> 0\n
548 i> write(4) -> 4:
549 i> 426\n
550 i> write(426) -> 426:
551 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
552 i> test\n
553 i> 0 0\n
554 i> foo\n
555 i> \n
556 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
557 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
558 i> \x00\x00\x00\x00\x00\x00\x00\x00
559 i> write(2) -> 2:
560 i> 0\n
561 i> flush() -> None
562 o> readline() -> 2:
563 o> 0\n
564 o> readline() -> 2:
565 o> 1\n
566 o> read(1) -> 1: 0
567 result: 0
568 remote output:
569 e> read(-1) -> 148:
570 e> adding changesets\n
571 e> adding manifests\n
572 e> adding file changes\n
573 e> printed line\n
574 e> transaction abort!\n
575 e> rollback completed\n
576 e> abort: pretxnchangegroup.fail hook failed\n
577
578 Mixed print() and ui.write() are both captured
579
580 $ cat > .hg/hgrc << EOF
581 > [hooks]
582 > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookprintandwrite
583 > EOF
584
585 $ debugwireproto << EOF
586 > command unbundle
587 > # This is "force" in hex.
588 > heads 666f726365
589 > PUSHFILE ../initial.v1.hg
590 > readavailable
591 > EOF
592 testing ssh1
593 creating ssh peer from handshake results
594 i> write(104) -> 104:
595 i> hello\n
596 i> between\n
597 i> pairs 81\n
598 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
599 i> flush() -> None
600 o> readline() -> 4:
601 o> \d+\\n (re)
602 o> readline\(\) -> \d+: (re)
603 o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re)
604 o> readline() -> 2:
605 o> 1\n
606 o> readline() -> 1:
607 o> \n
608 sending unbundle command
609 i> write(9) -> 9:
610 i> unbundle\n
611 i> write(9) -> 9:
612 i> heads 10\n
613 i> write(10) -> 10: 666f726365
614 i> flush() -> None
615 o> readline() -> 2:
616 o> 0\n
617 i> write(4) -> 4:
618 i> 426\n
619 i> write(426) -> 426:
620 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
621 i> test\n
622 i> 0 0\n
623 i> foo\n
624 i> \n
625 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
626 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
627 i> \x00\x00\x00\x00\x00\x00\x00\x00
628 i> write(2) -> 2:
629 i> 0\n
630 i> flush() -> None
631 o> readline() -> 2:
632 o> 0\n
633 o> readline() -> 2:
634 o> 1\n
635 o> read(1) -> 1: 0
636 result: 0
637 remote output:
638 e> read(-1) -> 173:
639 e> adding changesets\n
640 e> adding manifests\n
641 e> adding file changes\n
642 e> print 1\n
643 e> ui.write 1\n
644 e> print 2\n
645 e> ui.write 2\n
646 e> transaction abort!\n
647 e> rollback completed\n
648 e> abort: pretxnchangegroup.fail hook failed\n
649
650 print() to stdout and stderr both get captured
651
652 $ cat > .hg/hgrc << EOF
653 > [hooks]
654 > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookprintstderrandstdout
655 > EOF
656
657 $ debugwireproto << EOF
658 > command unbundle
659 > # This is "force" in hex.
660 > heads 666f726365
661 > PUSHFILE ../initial.v1.hg
662 > readavailable
663 > EOF
664 testing ssh1
665 creating ssh peer from handshake results
666 i> write(104) -> 104:
667 i> hello\n
668 i> between\n
669 i> pairs 81\n
670 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
671 i> flush() -> None
672 o> readline() -> 4:
673 o> \d+\\n (re)
674 o> readline\(\) -> \d+: (re)
675 o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re)
676 o> readline() -> 2:
677 o> 1\n
678 o> readline() -> 1:
679 o> \n
680 sending unbundle command
681 i> write(9) -> 9:
682 i> unbundle\n
683 i> write(9) -> 9:
684 i> heads 10\n
685 i> write(10) -> 10: 666f726365
686 i> flush() -> None
687 o> readline() -> 2:
688 o> 0\n
689 i> write(4) -> 4:
690 i> 426\n
691 i> write(426) -> 426:
692 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
693 i> test\n
694 i> 0 0\n
695 i> foo\n
696 i> \n
697 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
698 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
699 i> \x00\x00\x00\x00\x00\x00\x00\x00
700 i> write(2) -> 2:
701 i> 0\n
702 i> flush() -> None
703 o> readline() -> 2:
704 o> 0\n
705 o> readline() -> 2:
706 o> 1\n
707 o> read(1) -> 1: 0
708 result: 0
709 remote output:
710 e> read(-1) -> 171:
711 e> adding changesets\n
712 e> adding manifests\n
713 e> adding file changes\n
714 e> stdout 1\n
715 e> stderr 1\n
716 e> stdout 2\n
717 e> stderr 2\n
718 e> transaction abort!\n
719 e> rollback completed\n
720 e> abort: pretxnchangegroup.fail hook failed\n
721
722 Shell hook writing to stdout has output captured
723
724 $ cat > $TESTTMP/hook.sh << EOF
725 > echo 'stdout 1'
726 > echo 'stdout 2'
727 > exit 1
728 > EOF
729
730 $ cat > .hg/hgrc << EOF
731 > [hooks]
732 > pretxnchangegroup.fail = sh $TESTTMP/hook.sh
733 > EOF
734
735 $ debugwireproto << EOF
736 > command unbundle
737 > # This is "force" in hex.
738 > heads 666f726365
739 > PUSHFILE ../initial.v1.hg
740 > readavailable
741 > EOF
742 testing ssh1
743 creating ssh peer from handshake results
744 i> write(104) -> 104:
745 i> hello\n
746 i> between\n
747 i> pairs 81\n
748 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
749 i> flush() -> None
750 o> readline() -> 4:
751 o> \d+\\n (re)
752 o> readline\(\) -> \d+: (re)
753 o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re)
754 o> readline() -> 2:
755 o> 1\n
756 o> readline() -> 1:
757 o> \n
758 sending unbundle command
759 i> write(9) -> 9:
760 i> unbundle\n
761 i> write(9) -> 9:
762 i> heads 10\n
763 i> write(10) -> 10: 666f726365
764 i> flush() -> None
765 o> readline() -> 2:
766 o> 0\n
767 i> write(4) -> 4:
768 i> 426\n
769 i> write(426) -> 426:
770 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
771 i> test\n
772 i> 0 0\n
773 i> foo\n
774 i> \n
775 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
776 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
777 i> \x00\x00\x00\x00\x00\x00\x00\x00
778 i> write(2) -> 2:
779 i> 0\n
780 i> flush() -> None
781 o> readline() -> 2:
782 o> 0\n
783 o> readline() -> 2:
784 o> 1\n
785 o> read(1) -> 1: 0
786 result: 0
787 remote output:
788 e> read(-1) -> 167:
789 e> adding changesets\n
790 e> adding manifests\n
791 e> adding file changes\n
792 e> stdout 1\n
793 e> stdout 2\n
794 e> transaction abort!\n
795 e> rollback completed\n
796 e> abort: pretxnchangegroup.fail hook exited with status 1\n
797 Shell hook writing to stderr has output captured
798
799 $ cat > $TESTTMP/hook.sh << EOF
800 > echo 'stderr 1' 1>&2
801 > echo 'stderr 2' 1>&2
802 > exit 1
803 > EOF
804
805 $ debugwireproto << EOF
806 > command unbundle
807 > # This is "force" in hex.
808 > heads 666f726365
809 > PUSHFILE ../initial.v1.hg
810 > readavailable
811 > EOF
812 testing ssh1
813 creating ssh peer from handshake results
814 i> write(104) -> 104:
815 i> hello\n
816 i> between\n
817 i> pairs 81\n
818 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
819 i> flush() -> None
820 o> readline() -> 4:
821 o> \d+\\n (re)
822 o> readline\(\) -> \d+: (re)
823 o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re)
824 o> readline() -> 2:
825 o> 1\n
826 o> readline() -> 1:
827 o> \n
828 sending unbundle command
829 i> write(9) -> 9:
830 i> unbundle\n
831 i> write(9) -> 9:
832 i> heads 10\n
833 i> write(10) -> 10: 666f726365
834 i> flush() -> None
835 o> readline() -> 2:
836 o> 0\n
837 i> write(4) -> 4:
838 i> 426\n
839 i> write(426) -> 426:
840 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
841 i> test\n
842 i> 0 0\n
843 i> foo\n
844 i> \n
845 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
846 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
847 i> \x00\x00\x00\x00\x00\x00\x00\x00
848 i> write(2) -> 2:
849 i> 0\n
850 i> flush() -> None
851 o> readline() -> 2:
852 o> 0\n
853 o> readline() -> 2:
854 o> 1\n
855 o> read(1) -> 1: 0
856 result: 0
857 remote output:
858 e> read(-1) -> 167:
859 e> adding changesets\n
860 e> adding manifests\n
861 e> adding file changes\n
862 e> stderr 1\n
863 e> stderr 2\n
864 e> transaction abort!\n
865 e> rollback completed\n
866 e> abort: pretxnchangegroup.fail hook exited with status 1\n
867 Shell hook writing to stdout and stderr has output captured
868
869 $ cat > $TESTTMP/hook.sh << EOF
870 > echo 'stdout 1'
871 > echo 'stderr 1' 1>&2
872 > echo 'stdout 2'
873 > echo 'stderr 2' 1>&2
874 > exit 1
875 > EOF
876
877 $ debugwireproto << EOF
878 > command unbundle
879 > # This is "force" in hex.
880 > heads 666f726365
881 > PUSHFILE ../initial.v1.hg
882 > readavailable
883 > EOF
884 testing ssh1
885 creating ssh peer from handshake results
886 i> write(104) -> 104:
887 i> hello\n
888 i> between\n
889 i> pairs 81\n
890 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
891 i> flush() -> None
892 o> readline() -> 4:
893 o> \d+\\n (re)
894 o> readline\(\) -> \d+: (re)
895 o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re)
896 o> readline() -> 2:
897 o> 1\n
898 o> readline() -> 1:
899 o> \n
900 sending unbundle command
901 i> write(9) -> 9:
902 i> unbundle\n
903 i> write(9) -> 9:
904 i> heads 10\n
905 i> write(10) -> 10: 666f726365
906 i> flush() -> None
907 o> readline() -> 2:
908 o> 0\n
909 i> write(4) -> 4:
910 i> 426\n
911 i> write(426) -> 426:
912 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
913 i> test\n
914 i> 0 0\n
915 i> foo\n
916 i> \n
917 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
918 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
919 i> \x00\x00\x00\x00\x00\x00\x00\x00
920 i> write(2) -> 2:
921 i> 0\n
922 i> flush() -> None
923 o> readline() -> 2:
924 o> 0\n
925 o> readline() -> 2:
926 o> 1\n
927 o> read(1) -> 1: 0
928 result: 0
929 remote output:
930 e> read(-1) -> 185:
931 e> adding changesets\n
932 e> adding manifests\n
933 e> adding file changes\n
934 e> stdout 1\n
935 e> stderr 1\n
936 e> stdout 2\n
937 e> stderr 2\n
938 e> transaction abort!\n
939 e> rollback completed\n
940 e> abort: pretxnchangegroup.fail hook exited with status 1\n
941 Shell and Python hooks writing to stdout and stderr have output captured
942
943 $ cat > $TESTTMP/hook.sh << EOF
944 > echo 'shell stdout 1'
945 > echo 'shell stderr 1' 1>&2
946 > echo 'shell stdout 2'
947 > echo 'shell stderr 2' 1>&2
948 > exit 0
949 > EOF
950
951 $ cat > .hg/hgrc << EOF
952 > [hooks]
953 > pretxnchangegroup.a = sh $TESTTMP/hook.sh
954 > pretxnchangegroup.b = python:$TESTTMP/failhook:hookprintstderrandstdout
955 > EOF
956
957 $ debugwireproto << EOF
958 > command unbundle
959 > # This is "force" in hex.
960 > heads 666f726365
961 > PUSHFILE ../initial.v1.hg
962 > readavailable
963 > EOF
964 testing ssh1
965 creating ssh peer from handshake results
966 i> write(104) -> 104:
967 i> hello\n
968 i> between\n
969 i> pairs 81\n
970 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
971 i> flush() -> None
972 o> readline() -> 4:
973 o> \d+\\n (re)
974 o> readline\(\) -> \d+: (re)
975 o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re)
976 o> readline() -> 2:
977 o> 1\n
978 o> readline() -> 1:
979 o> \n
980 sending unbundle command
981 i> write(9) -> 9:
982 i> unbundle\n
983 i> write(9) -> 9:
984 i> heads 10\n
985 i> write(10) -> 10: 666f726365
986 i> flush() -> None
987 o> readline() -> 2:
988 o> 0\n
989 i> write(4) -> 4:
990 i> 426\n
991 i> write(426) -> 426:
992 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
993 i> test\n
994 i> 0 0\n
995 i> foo\n
996 i> \n
997 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
998 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
999 i> \x00\x00\x00\x00\x00\x00\x00\x00
1000 i> write(2) -> 2:
1001 i> 0\n
1002 i> flush() -> None
1003 o> readline() -> 2:
1004 o> 0\n
1005 o> readline() -> 2:
1006 o> 1\n
1007 o> read(1) -> 1: 0
1008 result: 0
1009 remote output:
1010 e> read(-1) -> 228:
1011 e> adding changesets\n
1012 e> adding manifests\n
1013 e> adding file changes\n
1014 e> shell stdout 1\n
1015 e> shell stderr 1\n
1016 e> shell stdout 2\n
1017 e> shell stderr 2\n
1018 e> stdout 1\n
1019 e> stderr 1\n
1020 e> stdout 2\n
1021 e> stderr 2\n
1022 e> transaction abort!\n
1023 e> rollback completed\n
1024 e> abort: pretxnchangegroup.b hook failed\n
1025 $ cd ..
1026
1027 Pushing a bundle1 with no output
1028
1029 $ hg init simplerepo
1030 $ cd simplerepo
1031
1032 $ debugwireproto 1 << EOF
1033 > command unbundle
1034 > # This is "force" in hex.
1035 > heads 666f726365
1036 > PUSHFILE ../initial.v1.hg
1037 > readavailable
1038 > EOF
1039 testing ssh1
1040 creating ssh peer from handshake results
1041 i> write(104) -> 104:
1042 i> hello\n
1043 i> between\n
1044 i> pairs 81\n
1045 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1046 i> flush() -> None
1047 o> readline() -> 4:
1048 o> \d+\\n (re)
1049 o> readline\(\) -> \d+: (re)
1050 o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re)
1051 o> readline() -> 2:
1052 o> 1\n
1053 o> readline() -> 1:
1054 o> \n
1055 sending unbundle command
1056 i> write(9) -> 9:
1057 i> unbundle\n
1058 i> write(9) -> 9:
1059 i> heads 10\n
1060 i> write(10) -> 10: 666f726365
1061 i> flush() -> None
1062 o> readline() -> 2:
1063 o> 0\n
1064 i> write(4) -> 4:
1065 i> 426\n
1066 i> write(426) -> 426:
1067 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1068 i> test\n
1069 i> 0 0\n
1070 i> foo\n
1071 i> \n
1072 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1073 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1074 i> \x00\x00\x00\x00\x00\x00\x00\x00
1075 i> write(2) -> 2:
1076 i> 0\n
1077 i> flush() -> None
1078 o> readline() -> 2:
1079 o> 0\n
1080 o> readline() -> 2:
1081 o> 1\n
1082 o> read(1) -> 1: 1
1083 result: 1
1084 remote output:
1085 e> read(-1) -> 100:
1086 e> adding changesets\n
1087 e> adding manifests\n
1088 e> adding file changes\n
1089 e> added 1 changesets with 1 changes to 1 files\n
1090 $ cd ..
1091
1092 Pushing a bundle1 with ui.write() and ui.write_err()
1093
1094 $ cat > $TESTTMP/hook << EOF
1095 > def hookuiwrite(ui, repo, **kwargs):
1096 > ui.write(b'ui.write 1\n')
1097 > ui.write_err(b'ui.write_err 1\n')
1098 > ui.write(b'ui.write 2\n')
1099 > ui.write_err(b'ui.write_err 2\n')
1100 > EOF
1101
1102 $ hg init uiwriterepo
1103 $ cd uiwriterepo
1104 $ cat > .hg/hgrc << EOF
1105 > [hooks]
1106 > pretxnchangegroup.hook = python:$TESTTMP/hook:hookuiwrite
1107 > EOF
1108
1109 $ debugwireproto 1 << EOF
1110 > command unbundle
1111 > # This is "force" in hex.
1112 > heads 666f726365
1113 > PUSHFILE ../initial.v1.hg
1114 > readavailable
1115 > EOF
1116 testing ssh1
1117 creating ssh peer from handshake results
1118 i> write(104) -> 104:
1119 i> hello\n
1120 i> between\n
1121 i> pairs 81\n
1122 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1123 i> flush() -> None
1124 o> readline() -> 4:
1125 o> \d+\\n (re)
1126 o> readline\(\) -> \d+: (re)
1127 o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re)
1128 o> readline() -> 2:
1129 o> 1\n
1130 o> readline() -> 1:
1131 o> \n
1132 sending unbundle command
1133 i> write(9) -> 9:
1134 i> unbundle\n
1135 i> write(9) -> 9:
1136 i> heads 10\n
1137 i> write(10) -> 10: 666f726365
1138 i> flush() -> None
1139 o> readline() -> 2:
1140 o> 0\n
1141 i> write(4) -> 4:
1142 i> 426\n
1143 i> write(426) -> 426:
1144 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1145 i> test\n
1146 i> 0 0\n
1147 i> foo\n
1148 i> \n
1149 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1150 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1151 i> \x00\x00\x00\x00\x00\x00\x00\x00
1152 i> write(2) -> 2:
1153 i> 0\n
1154 i> flush() -> None
1155 o> readline() -> 2:
1156 o> 0\n
1157 o> readline() -> 2:
1158 o> 1\n
1159 o> read(1) -> 1: 1
1160 result: 1
1161 remote output:
1162 e> read(-1) -> 152:
1163 e> adding changesets\n
1164 e> adding manifests\n
1165 e> adding file changes\n
1166 e> ui.write 1\n
1167 e> ui.write_err 1\n
1168 e> ui.write 2\n
1169 e> ui.write_err 2\n
1170 e> added 1 changesets with 1 changes to 1 files\n