1 |
|
2 $ getmainid() { |
|
3 > hg -R main log --template '{node}\n' --rev "$1" |
|
4 > } |
|
5 |
|
6 Create an extension to test bundle2 API |
|
7 |
|
8 $ cat > bundle2.py << EOF |
|
9 > """A small extension to test bundle2 implementation |
|
10 > |
|
11 > Current bundle2 implementation is far too limited to be used in any core |
|
12 > code. We still need to be able to test it while it grow up. |
|
13 > """ |
|
14 > |
|
15 > import sys, os |
|
16 > from mercurial import cmdutil |
|
17 > from mercurial import util |
|
18 > from mercurial import bundle2 |
|
19 > from mercurial import scmutil |
|
20 > from mercurial import discovery |
|
21 > from mercurial import changegroup |
|
22 > from mercurial import error |
|
23 > from mercurial import obsolete |
|
24 > |
|
25 > obsolete._enabled = True |
|
26 > |
|
27 > try: |
|
28 > import msvcrt |
|
29 > msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY) |
|
30 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) |
|
31 > msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY) |
|
32 > except ImportError: |
|
33 > pass |
|
34 > |
|
35 > cmdtable = {} |
|
36 > command = cmdutil.command(cmdtable) |
|
37 > |
|
38 > ELEPHANTSSONG = """Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko |
|
39 > Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko |
|
40 > Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.""" |
|
41 > assert len(ELEPHANTSSONG) == 178 # future test say 178 bytes, trust it. |
|
42 > |
|
43 > @bundle2.parthandler('test:song') |
|
44 > def songhandler(op, part): |
|
45 > """handle a "test:song" bundle2 part, printing the lyrics on stdin""" |
|
46 > op.ui.write('The choir starts singing:\n') |
|
47 > verses = 0 |
|
48 > for line in part.read().split('\n'): |
|
49 > op.ui.write(' %s\n' % line) |
|
50 > verses += 1 |
|
51 > op.records.add('song', {'verses': verses}) |
|
52 > |
|
53 > @bundle2.parthandler('test:ping') |
|
54 > def pinghandler(op, part): |
|
55 > op.ui.write('received ping request (id %i)\n' % part.id) |
|
56 > if op.reply is not None and 'ping-pong' in op.reply.capabilities: |
|
57 > op.ui.write_err('replying to ping request (id %i)\n' % part.id) |
|
58 > op.reply.newpart('test:pong', [('in-reply-to', str(part.id))]) |
|
59 > |
|
60 > @bundle2.parthandler('test:debugreply') |
|
61 > def debugreply(op, part): |
|
62 > """print data about the capacity of the bundle reply""" |
|
63 > if op.reply is None: |
|
64 > op.ui.write('debugreply: no reply\n') |
|
65 > else: |
|
66 > op.ui.write('debugreply: capabilities:\n') |
|
67 > for cap in sorted(op.reply.capabilities): |
|
68 > op.ui.write('debugreply: %r\n' % cap) |
|
69 > for val in op.reply.capabilities[cap]: |
|
70 > op.ui.write('debugreply: %r\n' % val) |
|
71 > |
|
72 > @command('bundle2', |
|
73 > [('', 'param', [], 'stream level parameter'), |
|
74 > ('', 'unknown', False, 'include an unknown mandatory part in the bundle'), |
|
75 > ('', 'unknownparams', False, 'include an unknown part parameters in the bundle'), |
|
76 > ('', 'parts', False, 'include some arbitrary parts to the bundle'), |
|
77 > ('', 'reply', False, 'produce a reply bundle'), |
|
78 > ('', 'pushrace', False, 'includes a check:head part with unknown nodes'), |
|
79 > ('r', 'rev', [], 'includes those changeset in the bundle'),], |
|
80 > '[OUTPUTFILE]') |
|
81 > def cmdbundle2(ui, repo, path=None, **opts): |
|
82 > """write a bundle2 container on standard ouput""" |
|
83 > bundler = bundle2.bundle20(ui) |
|
84 > for p in opts['param']: |
|
85 > p = p.split('=', 1) |
|
86 > try: |
|
87 > bundler.addparam(*p) |
|
88 > except ValueError, exc: |
|
89 > raise util.Abort('%s' % exc) |
|
90 > |
|
91 > if opts['reply']: |
|
92 > capsstring = 'ping-pong\nelephants=babar,celeste\ncity%3D%21=celeste%2Cville' |
|
93 > bundler.newpart('b2x:replycaps', data=capsstring) |
|
94 > |
|
95 > if opts['pushrace']: |
|
96 > # also serve to test the assignement of data outside of init |
|
97 > part = bundler.newpart('b2x:check:heads') |
|
98 > part.data = '01234567890123456789' |
|
99 > |
|
100 > revs = opts['rev'] |
|
101 > if 'rev' in opts: |
|
102 > revs = scmutil.revrange(repo, opts['rev']) |
|
103 > if revs: |
|
104 > # very crude version of a changegroup part creation |
|
105 > bundled = repo.revs('%ld::%ld', revs, revs) |
|
106 > headmissing = [c.node() for c in repo.set('heads(%ld)', revs)] |
|
107 > headcommon = [c.node() for c in repo.set('parents(%ld) - %ld', revs, revs)] |
|
108 > outgoing = discovery.outgoing(repo.changelog, headcommon, headmissing) |
|
109 > cg = changegroup.getlocalchangegroup(repo, 'test:bundle2', outgoing, None) |
|
110 > bundler.newpart('b2x:changegroup', data=cg.getchunks()) |
|
111 > |
|
112 > if opts['parts']: |
|
113 > bundler.newpart('test:empty') |
|
114 > # add a second one to make sure we handle multiple parts |
|
115 > bundler.newpart('test:empty') |
|
116 > bundler.newpart('test:song', data=ELEPHANTSSONG) |
|
117 > bundler.newpart('test:debugreply') |
|
118 > mathpart = bundler.newpart('test:math') |
|
119 > mathpart.addparam('pi', '3.14') |
|
120 > mathpart.addparam('e', '2.72') |
|
121 > mathpart.addparam('cooking', 'raw', mandatory=False) |
|
122 > mathpart.data = '42' |
|
123 > # advisory known part with unknown mandatory param |
|
124 > bundler.newpart('test:song', [('randomparam','')]) |
|
125 > if opts['unknown']: |
|
126 > bundler.newpart('test:UNKNOWN', data='some random content') |
|
127 > if opts['unknownparams']: |
|
128 > bundler.newpart('test:SONG', [('randomparams', '')]) |
|
129 > if opts['parts']: |
|
130 > bundler.newpart('test:ping') |
|
131 > |
|
132 > if path is None: |
|
133 > file = sys.stdout |
|
134 > else: |
|
135 > file = open(path, 'wb') |
|
136 > |
|
137 > for chunk in bundler.getchunks(): |
|
138 > file.write(chunk) |
|
139 > |
|
140 > @command('unbundle2', [], '') |
|
141 > def cmdunbundle2(ui, repo, replypath=None): |
|
142 > """process a bundle2 stream from stdin on the current repo""" |
|
143 > try: |
|
144 > tr = None |
|
145 > lock = repo.lock() |
|
146 > tr = repo.transaction('processbundle') |
|
147 > try: |
|
148 > unbundler = bundle2.unbundle20(ui, sys.stdin) |
|
149 > op = bundle2.processbundle(repo, unbundler, lambda: tr) |
|
150 > tr.close() |
|
151 > except error.BundleValueError, exc: |
|
152 > raise util.Abort('missing support for %s' % exc) |
|
153 > except error.PushRaced, exc: |
|
154 > raise util.Abort('push race: %s' % exc) |
|
155 > finally: |
|
156 > if tr is not None: |
|
157 > tr.release() |
|
158 > lock.release() |
|
159 > remains = sys.stdin.read() |
|
160 > ui.write('%i unread bytes\n' % len(remains)) |
|
161 > if op.records['song']: |
|
162 > totalverses = sum(r['verses'] for r in op.records['song']) |
|
163 > ui.write('%i total verses sung\n' % totalverses) |
|
164 > for rec in op.records['changegroup']: |
|
165 > ui.write('addchangegroup return: %i\n' % rec['return']) |
|
166 > if op.reply is not None and replypath is not None: |
|
167 > file = open(replypath, 'wb') |
|
168 > for chunk in op.reply.getchunks(): |
|
169 > file.write(chunk) |
|
170 > |
|
171 > @command('statbundle2', [], '') |
|
172 > def cmdstatbundle2(ui, repo): |
|
173 > """print statistic on the bundle2 container read from stdin""" |
|
174 > unbundler = bundle2.unbundle20(ui, sys.stdin) |
|
175 > try: |
|
176 > params = unbundler.params |
|
177 > except error.BundleValueError, exc: |
|
178 > raise util.Abort('unknown parameters: %s' % exc) |
|
179 > ui.write('options count: %i\n' % len(params)) |
|
180 > for key in sorted(params): |
|
181 > ui.write('- %s\n' % key) |
|
182 > value = params[key] |
|
183 > if value is not None: |
|
184 > ui.write(' %s\n' % value) |
|
185 > count = 0 |
|
186 > for p in unbundler.iterparts(): |
|
187 > count += 1 |
|
188 > ui.write(' :%s:\n' % p.type) |
|
189 > ui.write(' mandatory: %i\n' % len(p.mandatoryparams)) |
|
190 > ui.write(' advisory: %i\n' % len(p.advisoryparams)) |
|
191 > ui.write(' payload: %i bytes\n' % len(p.read())) |
|
192 > ui.write('parts count: %i\n' % count) |
|
193 > EOF |
|
194 $ cat >> $HGRCPATH << EOF |
|
195 > [extensions] |
|
196 > bundle2=$TESTTMP/bundle2.py |
|
197 > [experimental] |
|
198 > bundle2-exp=True |
|
199 > [ui] |
|
200 > ssh=python "$TESTDIR/dummyssh" |
|
201 > logtemplate={rev}:{node|short} {phase} {author} {bookmarks} {desc|firstline} |
|
202 > [web] |
|
203 > push_ssl = false |
|
204 > allow_push = * |
|
205 > [phases] |
|
206 > publish=False |
|
207 > EOF |
|
208 |
|
209 The extension requires a repo (currently unused) |
|
210 |
|
211 $ hg init main |
|
212 $ cd main |
|
213 $ touch a |
|
214 $ hg add a |
|
215 $ hg commit -m 'a' |
|
216 |
|
217 |
|
218 Empty bundle |
|
219 ================= |
|
220 |
|
221 - no option |
|
222 - no parts |
|
223 |
|
224 Test bundling |
|
225 |
|
226 $ hg bundle2 |
|
227 HG2X\x00\x00\x00\x00 (no-eol) (esc) |
|
228 |
|
229 Test unbundling |
|
230 |
|
231 $ hg bundle2 | hg statbundle2 |
|
232 options count: 0 |
|
233 parts count: 0 |
|
234 |
|
235 Test old style bundle are detected and refused |
|
236 |
|
237 $ hg bundle --all ../bundle.hg |
|
238 1 changesets found |
|
239 $ hg statbundle2 < ../bundle.hg |
|
240 abort: unknown bundle version 10 |
|
241 [255] |
|
242 |
|
243 Test parameters |
|
244 ================= |
|
245 |
|
246 - some options |
|
247 - no parts |
|
248 |
|
249 advisory parameters, no value |
|
250 ------------------------------- |
|
251 |
|
252 Simplest possible parameters form |
|
253 |
|
254 Test generation simple option |
|
255 |
|
256 $ hg bundle2 --param 'caution' |
|
257 HG2X\x00\x07caution\x00\x00 (no-eol) (esc) |
|
258 |
|
259 Test unbundling |
|
260 |
|
261 $ hg bundle2 --param 'caution' | hg statbundle2 |
|
262 options count: 1 |
|
263 - caution |
|
264 parts count: 0 |
|
265 |
|
266 Test generation multiple option |
|
267 |
|
268 $ hg bundle2 --param 'caution' --param 'meal' |
|
269 HG2X\x00\x0ccaution meal\x00\x00 (no-eol) (esc) |
|
270 |
|
271 Test unbundling |
|
272 |
|
273 $ hg bundle2 --param 'caution' --param 'meal' | hg statbundle2 |
|
274 options count: 2 |
|
275 - caution |
|
276 - meal |
|
277 parts count: 0 |
|
278 |
|
279 advisory parameters, with value |
|
280 ------------------------------- |
|
281 |
|
282 Test generation |
|
283 |
|
284 $ hg bundle2 --param 'caution' --param 'meal=vegan' --param 'elephants' |
|
285 HG2X\x00\x1ccaution meal=vegan elephants\x00\x00 (no-eol) (esc) |
|
286 |
|
287 Test unbundling |
|
288 |
|
289 $ hg bundle2 --param 'caution' --param 'meal=vegan' --param 'elephants' | hg statbundle2 |
|
290 options count: 3 |
|
291 - caution |
|
292 - elephants |
|
293 - meal |
|
294 vegan |
|
295 parts count: 0 |
|
296 |
|
297 parameter with special char in value |
|
298 --------------------------------------------------- |
|
299 |
|
300 Test generation |
|
301 |
|
302 $ hg bundle2 --param 'e|! 7/=babar%#==tutu' --param simple |
|
303 HG2X\x00)e%7C%21%207/=babar%25%23%3D%3Dtutu simple\x00\x00 (no-eol) (esc) |
|
304 |
|
305 Test unbundling |
|
306 |
|
307 $ hg bundle2 --param 'e|! 7/=babar%#==tutu' --param simple | hg statbundle2 |
|
308 options count: 2 |
|
309 - e|! 7/ |
|
310 babar%#==tutu |
|
311 - simple |
|
312 parts count: 0 |
|
313 |
|
314 Test unknown mandatory option |
|
315 --------------------------------------------------- |
|
316 |
|
317 $ hg bundle2 --param 'Gravity' | hg statbundle2 |
|
318 abort: unknown parameters: Stream Parameter - Gravity |
|
319 [255] |
|
320 |
|
321 Test debug output |
|
322 --------------------------------------------------- |
|
323 |
|
324 bundling debug |
|
325 |
|
326 $ hg bundle2 --debug --param 'e|! 7/=babar%#==tutu' --param simple ../out.hg2 |
|
327 start emission of HG2X stream |
|
328 bundle parameter: e%7C%21%207/=babar%25%23%3D%3Dtutu simple |
|
329 start of parts |
|
330 end of bundle |
|
331 |
|
332 file content is ok |
|
333 |
|
334 $ cat ../out.hg2 |
|
335 HG2X\x00)e%7C%21%207/=babar%25%23%3D%3Dtutu simple\x00\x00 (no-eol) (esc) |
|
336 |
|
337 unbundling debug |
|
338 |
|
339 $ hg statbundle2 --debug < ../out.hg2 |
|
340 start processing of HG2X stream |
|
341 reading bundle2 stream parameters |
|
342 ignoring unknown parameter 'e|! 7/' |
|
343 ignoring unknown parameter 'simple' |
|
344 options count: 2 |
|
345 - e|! 7/ |
|
346 babar%#==tutu |
|
347 - simple |
|
348 start extraction of bundle2 parts |
|
349 part header size: 0 |
|
350 end of bundle2 stream |
|
351 parts count: 0 |
|
352 |
|
353 |
|
354 Test buggy input |
|
355 --------------------------------------------------- |
|
356 |
|
357 empty parameter name |
|
358 |
|
359 $ hg bundle2 --param '' --quiet |
|
360 abort: empty parameter name |
|
361 [255] |
|
362 |
|
363 bad parameter name |
|
364 |
|
365 $ hg bundle2 --param 42babar |
|
366 abort: non letter first character: '42babar' |
|
367 [255] |
|
368 |
|
369 |
|
370 Test part |
|
371 ================= |
|
372 |
|
373 $ hg bundle2 --parts ../parts.hg2 --debug |
|
374 start emission of HG2X stream |
|
375 bundle parameter: |
|
376 start of parts |
|
377 bundle part: "test:empty" |
|
378 bundle part: "test:empty" |
|
379 bundle part: "test:song" |
|
380 bundle part: "test:debugreply" |
|
381 bundle part: "test:math" |
|
382 bundle part: "test:song" |
|
383 bundle part: "test:ping" |
|
384 end of bundle |
|
385 |
|
386 $ cat ../parts.hg2 |
|
387 HG2X\x00\x00\x00\x11 (esc) |
|
388 test:empty\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11 (esc) |
|
389 test:empty\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x10 test:song\x00\x00\x00\x02\x00\x00\x00\x00\x00\xb2Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko (esc) |
|
390 Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko |
|
391 Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.\x00\x00\x00\x00\x00\x16\x0ftest:debugreply\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00+ test:math\x00\x00\x00\x04\x02\x01\x02\x04\x01\x04\x07\x03pi3.14e2.72cookingraw\x00\x00\x00\x0242\x00\x00\x00\x00\x00\x1d test:song\x00\x00\x00\x05\x01\x00\x0b\x00randomparam\x00\x00\x00\x00\x00\x10 test:ping\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc) |
|
392 |
|
393 |
|
394 $ hg statbundle2 < ../parts.hg2 |
|
395 options count: 0 |
|
396 :test:empty: |
|
397 mandatory: 0 |
|
398 advisory: 0 |
|
399 payload: 0 bytes |
|
400 :test:empty: |
|
401 mandatory: 0 |
|
402 advisory: 0 |
|
403 payload: 0 bytes |
|
404 :test:song: |
|
405 mandatory: 0 |
|
406 advisory: 0 |
|
407 payload: 178 bytes |
|
408 :test:debugreply: |
|
409 mandatory: 0 |
|
410 advisory: 0 |
|
411 payload: 0 bytes |
|
412 :test:math: |
|
413 mandatory: 2 |
|
414 advisory: 1 |
|
415 payload: 2 bytes |
|
416 :test:song: |
|
417 mandatory: 1 |
|
418 advisory: 0 |
|
419 payload: 0 bytes |
|
420 :test:ping: |
|
421 mandatory: 0 |
|
422 advisory: 0 |
|
423 payload: 0 bytes |
|
424 parts count: 7 |
|
425 |
|
426 $ hg statbundle2 --debug < ../parts.hg2 |
|
427 start processing of HG2X stream |
|
428 reading bundle2 stream parameters |
|
429 options count: 0 |
|
430 start extraction of bundle2 parts |
|
431 part header size: 17 |
|
432 part type: "test:empty" |
|
433 part id: "0" |
|
434 part parameters: 0 |
|
435 :test:empty: |
|
436 mandatory: 0 |
|
437 advisory: 0 |
|
438 payload chunk size: 0 |
|
439 payload: 0 bytes |
|
440 part header size: 17 |
|
441 part type: "test:empty" |
|
442 part id: "1" |
|
443 part parameters: 0 |
|
444 :test:empty: |
|
445 mandatory: 0 |
|
446 advisory: 0 |
|
447 payload chunk size: 0 |
|
448 payload: 0 bytes |
|
449 part header size: 16 |
|
450 part type: "test:song" |
|
451 part id: "2" |
|
452 part parameters: 0 |
|
453 :test:song: |
|
454 mandatory: 0 |
|
455 advisory: 0 |
|
456 payload chunk size: 178 |
|
457 payload chunk size: 0 |
|
458 payload: 178 bytes |
|
459 part header size: 22 |
|
460 part type: "test:debugreply" |
|
461 part id: "3" |
|
462 part parameters: 0 |
|
463 :test:debugreply: |
|
464 mandatory: 0 |
|
465 advisory: 0 |
|
466 payload chunk size: 0 |
|
467 payload: 0 bytes |
|
468 part header size: 43 |
|
469 part type: "test:math" |
|
470 part id: "4" |
|
471 part parameters: 3 |
|
472 :test:math: |
|
473 mandatory: 2 |
|
474 advisory: 1 |
|
475 payload chunk size: 2 |
|
476 payload chunk size: 0 |
|
477 payload: 2 bytes |
|
478 part header size: 29 |
|
479 part type: "test:song" |
|
480 part id: "5" |
|
481 part parameters: 1 |
|
482 :test:song: |
|
483 mandatory: 1 |
|
484 advisory: 0 |
|
485 payload chunk size: 0 |
|
486 payload: 0 bytes |
|
487 part header size: 16 |
|
488 part type: "test:ping" |
|
489 part id: "6" |
|
490 part parameters: 0 |
|
491 :test:ping: |
|
492 mandatory: 0 |
|
493 advisory: 0 |
|
494 payload chunk size: 0 |
|
495 payload: 0 bytes |
|
496 part header size: 0 |
|
497 end of bundle2 stream |
|
498 parts count: 7 |
|
499 |
|
500 Test actual unbundling of test part |
|
501 ======================================= |
|
502 |
|
503 Process the bundle |
|
504 |
|
505 $ hg unbundle2 --debug < ../parts.hg2 |
|
506 start processing of HG2X stream |
|
507 reading bundle2 stream parameters |
|
508 start extraction of bundle2 parts |
|
509 part header size: 17 |
|
510 part type: "test:empty" |
|
511 part id: "0" |
|
512 part parameters: 0 |
|
513 ignoring unsupported advisory part test:empty |
|
514 payload chunk size: 0 |
|
515 part header size: 17 |
|
516 part type: "test:empty" |
|
517 part id: "1" |
|
518 part parameters: 0 |
|
519 ignoring unsupported advisory part test:empty |
|
520 payload chunk size: 0 |
|
521 part header size: 16 |
|
522 part type: "test:song" |
|
523 part id: "2" |
|
524 part parameters: 0 |
|
525 found a handler for part 'test:song' |
|
526 The choir starts singing: |
|
527 payload chunk size: 178 |
|
528 payload chunk size: 0 |
|
529 Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko |
|
530 Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko |
|
531 Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko. |
|
532 part header size: 22 |
|
533 part type: "test:debugreply" |
|
534 part id: "3" |
|
535 part parameters: 0 |
|
536 found a handler for part 'test:debugreply' |
|
537 debugreply: no reply |
|
538 payload chunk size: 0 |
|
539 part header size: 43 |
|
540 part type: "test:math" |
|
541 part id: "4" |
|
542 part parameters: 3 |
|
543 ignoring unsupported advisory part test:math |
|
544 payload chunk size: 2 |
|
545 payload chunk size: 0 |
|
546 part header size: 29 |
|
547 part type: "test:song" |
|
548 part id: "5" |
|
549 part parameters: 1 |
|
550 found a handler for part 'test:song' |
|
551 ignoring unsupported advisory part test:song - randomparam |
|
552 payload chunk size: 0 |
|
553 part header size: 16 |
|
554 part type: "test:ping" |
|
555 part id: "6" |
|
556 part parameters: 0 |
|
557 found a handler for part 'test:ping' |
|
558 received ping request (id 6) |
|
559 payload chunk size: 0 |
|
560 part header size: 0 |
|
561 end of bundle2 stream |
|
562 0 unread bytes |
|
563 3 total verses sung |
|
564 |
|
565 Unbundle with an unknown mandatory part |
|
566 (should abort) |
|
567 |
|
568 $ hg bundle2 --parts --unknown ../unknown.hg2 |
|
569 |
|
570 $ hg unbundle2 < ../unknown.hg2 |
|
571 The choir starts singing: |
|
572 Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko |
|
573 Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko |
|
574 Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko. |
|
575 debugreply: no reply |
|
576 0 unread bytes |
|
577 abort: missing support for test:unknown |
|
578 [255] |
|
579 |
|
580 Unbundle with an unknown mandatory part parameters |
|
581 (should abort) |
|
582 |
|
583 $ hg bundle2 --unknownparams ../unknown.hg2 |
|
584 |
|
585 $ hg unbundle2 < ../unknown.hg2 |
|
586 0 unread bytes |
|
587 abort: missing support for test:song - randomparams |
|
588 [255] |
|
589 |
|
590 unbundle with a reply |
|
591 |
|
592 $ hg bundle2 --parts --reply ../parts-reply.hg2 |
|
593 $ hg unbundle2 ../reply.hg2 < ../parts-reply.hg2 |
|
594 0 unread bytes |
|
595 3 total verses sung |
|
596 |
|
597 The reply is a bundle |
|
598 |
|
599 $ cat ../reply.hg2 |
|
600 HG2X\x00\x00\x00\x1f (esc) |
|
601 b2x:output\x00\x00\x00\x00\x00\x01\x0b\x01in-reply-to3\x00\x00\x00\xd9The choir starts singing: (esc) |
|
602 Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko |
|
603 Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko |
|
604 Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko. |
|
605 \x00\x00\x00\x00\x00\x1f (esc) |
|
606 b2x:output\x00\x00\x00\x01\x00\x01\x0b\x01in-reply-to4\x00\x00\x00\xc9debugreply: capabilities: (esc) |
|
607 debugreply: 'city=!' |
|
608 debugreply: 'celeste,ville' |
|
609 debugreply: 'elephants' |
|
610 debugreply: 'babar' |
|
611 debugreply: 'celeste' |
|
612 debugreply: 'ping-pong' |
|
613 \x00\x00\x00\x00\x00\x1e test:pong\x00\x00\x00\x02\x01\x00\x0b\x01in-reply-to7\x00\x00\x00\x00\x00\x1f (esc) |
|
614 b2x:output\x00\x00\x00\x03\x00\x01\x0b\x01in-reply-to7\x00\x00\x00=received ping request (id 7) (esc) |
|
615 replying to ping request (id 7) |
|
616 \x00\x00\x00\x00\x00\x00 (no-eol) (esc) |
|
617 |
|
618 The reply is valid |
|
619 |
|
620 $ hg statbundle2 < ../reply.hg2 |
|
621 options count: 0 |
|
622 :b2x:output: |
|
623 mandatory: 0 |
|
624 advisory: 1 |
|
625 payload: 217 bytes |
|
626 :b2x:output: |
|
627 mandatory: 0 |
|
628 advisory: 1 |
|
629 payload: 201 bytes |
|
630 :test:pong: |
|
631 mandatory: 1 |
|
632 advisory: 0 |
|
633 payload: 0 bytes |
|
634 :b2x:output: |
|
635 mandatory: 0 |
|
636 advisory: 1 |
|
637 payload: 61 bytes |
|
638 parts count: 4 |
|
639 |
|
640 Unbundle the reply to get the output: |
|
641 |
|
642 $ hg unbundle2 < ../reply.hg2 |
|
643 remote: The choir starts singing: |
|
644 remote: Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko |
|
645 remote: Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko |
|
646 remote: Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko. |
|
647 remote: debugreply: capabilities: |
|
648 remote: debugreply: 'city=!' |
|
649 remote: debugreply: 'celeste,ville' |
|
650 remote: debugreply: 'elephants' |
|
651 remote: debugreply: 'babar' |
|
652 remote: debugreply: 'celeste' |
|
653 remote: debugreply: 'ping-pong' |
|
654 remote: received ping request (id 7) |
|
655 remote: replying to ping request (id 7) |
|
656 0 unread bytes |
|
657 |
|
658 Test push race detection |
|
659 |
|
660 $ hg bundle2 --pushrace ../part-race.hg2 |
|
661 |
|
662 $ hg unbundle2 < ../part-race.hg2 |
|
663 0 unread bytes |
|
664 abort: push race: repository changed while pushing - please try again |
|
665 [255] |
|
666 |
|
667 Support for changegroup |
|
668 =================================== |
|
669 |
|
670 $ hg unbundle $TESTDIR/bundles/rebase.hg |
|
671 adding changesets |
|
672 adding manifests |
|
673 adding file changes |
|
674 added 8 changesets with 7 changes to 7 files (+3 heads) |
|
675 (run 'hg heads' to see heads, 'hg merge' to merge) |
|
676 |
|
677 $ hg log -G |
|
678 o 8:02de42196ebe draft Nicolas Dumazet <nicdumz.commits@gmail.com> H |
|
679 | |
|
680 | o 7:eea13746799a draft Nicolas Dumazet <nicdumz.commits@gmail.com> G |
|
681 |/| |
|
682 o | 6:24b6387c8c8c draft Nicolas Dumazet <nicdumz.commits@gmail.com> F |
|
683 | | |
|
684 | o 5:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E |
|
685 |/ |
|
686 | o 4:32af7686d403 draft Nicolas Dumazet <nicdumz.commits@gmail.com> D |
|
687 | | |
|
688 | o 3:5fddd98957c8 draft Nicolas Dumazet <nicdumz.commits@gmail.com> C |
|
689 | | |
|
690 | o 2:42ccdea3bb16 draft Nicolas Dumazet <nicdumz.commits@gmail.com> B |
|
691 |/ |
|
692 o 1:cd010b8cd998 draft Nicolas Dumazet <nicdumz.commits@gmail.com> A |
|
693 |
|
694 @ 0:3903775176ed draft test a |
|
695 |
|
696 |
|
697 $ hg bundle2 --debug --rev '8+7+5+4' ../rev.hg2 |
|
698 4 changesets found |
|
699 list of changesets: |
|
700 32af7686d403cf45b5d95f2d70cebea587ac806a |
|
701 9520eea781bcca16c1e15acc0ba14335a0e8e5ba |
|
702 eea13746799a9e0bfd88f29d3c2e9dc9389f524f |
|
703 02de42196ebee42ef284b6780a87cdc96e8eaab6 |
|
704 start emission of HG2X stream |
|
705 bundle parameter: |
|
706 start of parts |
|
707 bundle part: "b2x:changegroup" |
|
708 bundling: 1/4 changesets (25.00%) |
|
709 bundling: 2/4 changesets (50.00%) |
|
710 bundling: 3/4 changesets (75.00%) |
|
711 bundling: 4/4 changesets (100.00%) |
|
712 bundling: 1/4 manifests (25.00%) |
|
713 bundling: 2/4 manifests (50.00%) |
|
714 bundling: 3/4 manifests (75.00%) |
|
715 bundling: 4/4 manifests (100.00%) |
|
716 bundling: D 1/3 files (33.33%) |
|
717 bundling: E 2/3 files (66.67%) |
|
718 bundling: H 3/3 files (100.00%) |
|
719 end of bundle |
|
720 |
|
721 $ cat ../rev.hg2 |
|
722 HG2X\x00\x00\x00\x16\x0fb2x:changegroup\x00\x00\x00\x00\x00\x00\x00\x00\x06\x13\x00\x00\x00\xa42\xafv\x86\xd4\x03\xcfE\xb5\xd9_-p\xce\xbe\xa5\x87\xac\x80j_\xdd\xd9\x89W\xc8\xa5JMCm\xfe\x1d\xa9\xd8\x7f!\xa1\xb9{\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x002\xafv\x86\xd4\x03\xcfE\xb5\xd9_-p\xce\xbe\xa5\x87\xac\x80j\x00\x00\x00\x00\x00\x00\x00)\x00\x00\x00)6e1f4c47ecb533ffd0c8e52cdc88afb6cd39e20c (esc) |
|
723 \x00\x00\x00f\x00\x00\x00h\x00\x00\x00\x02D (esc) |
|
724 \x00\x00\x00i\x00\x00\x00j\x00\x00\x00\x01D\x00\x00\x00\xa4\x95 \xee\xa7\x81\xbc\xca\x16\xc1\xe1Z\xcc\x0b\xa1C5\xa0\xe8\xe5\xba\xcd\x01\x0b\x8c\xd9\x98\xf3\x98\x1aZ\x81\x15\xf9O\x8d\xa4\xabP`\x89\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x95 \xee\xa7\x81\xbc\xca\x16\xc1\xe1Z\xcc\x0b\xa1C5\xa0\xe8\xe5\xba\x00\x00\x00\x00\x00\x00\x00)\x00\x00\x00)4dece9c826f69490507b98c6383a3009b295837d (esc) |
|
725 \x00\x00\x00f\x00\x00\x00h\x00\x00\x00\x02E (esc) |
|
726 \x00\x00\x00i\x00\x00\x00j\x00\x00\x00\x01E\x00\x00\x00\xa2\xee\xa17Fy\x9a\x9e\x0b\xfd\x88\xf2\x9d<.\x9d\xc98\x9fRO$\xb68|\x8c\x8c\xae7\x17\x88\x80\xf3\xfa\x95\xde\xd3\xcb\x1c\xf7\x85\x95 \xee\xa7\x81\xbc\xca\x16\xc1\xe1Z\xcc\x0b\xa1C5\xa0\xe8\xe5\xba\xee\xa17Fy\x9a\x9e\x0b\xfd\x88\xf2\x9d<.\x9d\xc98\x9fRO\x00\x00\x00\x00\x00\x00\x00)\x00\x00\x00)365b93d57fdf4814e2b5911d6bacff2b12014441 (esc) |
|
727 \x00\x00\x00f\x00\x00\x00h\x00\x00\x00\x00\x00\x00\x00i\x00\x00\x00j\x00\x00\x00\x01G\x00\x00\x00\xa4\x02\xdeB\x19n\xbe\xe4.\xf2\x84\xb6x (esc) |
|
728 \x87\xcd\xc9n\x8e\xaa\xb6$\xb68|\x8c\x8c\xae7\x17\x88\x80\xf3\xfa\x95\xde\xd3\xcb\x1c\xf7\x85\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xdeB\x19n\xbe\xe4.\xf2\x84\xb6x (esc) |
|
729 \x87\xcd\xc9n\x8e\xaa\xb6\x00\x00\x00\x00\x00\x00\x00)\x00\x00\x00)8bee48edc7318541fc0013ee41b089276a8c24bf (esc) |
|
730 \x00\x00\x00f\x00\x00\x00f\x00\x00\x00\x02H (esc) |
|
731 \x00\x00\x00g\x00\x00\x00h\x00\x00\x00\x01H\x00\x00\x00\x00\x00\x00\x00\x8bn\x1fLG\xec\xb53\xff\xd0\xc8\xe5,\xdc\x88\xaf\xb6\xcd9\xe2\x0cf\xa5\xa0\x18\x17\xfd\xf5#\x9c'8\x02\xb5\xb7a\x8d\x05\x1c\x89\xe4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x002\xafv\x86\xd4\x03\xcfE\xb5\xd9_-p\xce\xbe\xa5\x87\xac\x80j\x00\x00\x00\x81\x00\x00\x00\x81\x00\x00\x00+D\x00c3f1ca2924c16a19b0656a84900e504e5b0aec2d (esc) |
|
732 \x00\x00\x00\x8bM\xec\xe9\xc8&\xf6\x94\x90P{\x98\xc68:0 \xb2\x95\x83}\x00}\x8c\x9d\x88\x84\x13%\xf5\xc6\xb0cq\xb3[N\x8a+\x1a\x83\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x95 \xee\xa7\x81\xbc\xca\x16\xc1\xe1Z\xcc\x0b\xa1C5\xa0\xe8\xe5\xba\x00\x00\x00+\x00\x00\x00\xac\x00\x00\x00+E\x009c6fd0350a6c0d0c49d4a9c5017cf07043f54e58 (esc) |
|
733 \x00\x00\x00\x8b6[\x93\xd5\x7f\xdfH\x14\xe2\xb5\x91\x1dk\xac\xff+\x12\x01DA(\xa5\x84\xc6^\xf1!\xf8\x9e\xb6j\xb7\xd0\xbc\x15=\x80\x99\xe7\xceM\xec\xe9\xc8&\xf6\x94\x90P{\x98\xc68:0 \xb2\x95\x83}\xee\xa17Fy\x9a\x9e\x0b\xfd\x88\xf2\x9d<.\x9d\xc98\x9fRO\x00\x00\x00V\x00\x00\x00V\x00\x00\x00+F\x0022bfcfd62a21a3287edbd4d656218d0f525ed76a (esc) |
|
734 \x00\x00\x00\x97\x8b\xeeH\xed\xc71\x85A\xfc\x00\x13\xeeA\xb0\x89'j\x8c$\xbf(\xa5\x84\xc6^\xf1!\xf8\x9e\xb6j\xb7\xd0\xbc\x15=\x80\x99\xe7\xce\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xdeB\x19n\xbe\xe4.\xf2\x84\xb6x (esc) |
|
735 \x87\xcd\xc9n\x8e\xaa\xb6\x00\x00\x00+\x00\x00\x00V\x00\x00\x00\x00\x00\x00\x00\x81\x00\x00\x00\x81\x00\x00\x00+H\x008500189e74a9e0475e822093bc7db0d631aeb0b4 (esc) |
|
736 \x00\x00\x00\x00\x00\x00\x00\x05D\x00\x00\x00b\xc3\xf1\xca)$\xc1j\x19\xb0ej\x84\x90\x0ePN[ (esc) |
|
737 \xec-\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x002\xafv\x86\xd4\x03\xcfE\xb5\xd9_-p\xce\xbe\xa5\x87\xac\x80j\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02D (esc) |
|
738 \x00\x00\x00\x00\x00\x00\x00\x05E\x00\x00\x00b\x9co\xd05 (esc) |
|
739 l\r (no-eol) (esc) |
|
740 \x0cI\xd4\xa9\xc5\x01|\xf0pC\xf5NX\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x95 \xee\xa7\x81\xbc\xca\x16\xc1\xe1Z\xcc\x0b\xa1C5\xa0\xe8\xe5\xba\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02E (esc) |
|
741 \x00\x00\x00\x00\x00\x00\x00\x05H\x00\x00\x00b\x85\x00\x18\x9et\xa9\xe0G^\x82 \x93\xbc}\xb0\xd61\xae\xb0\xb4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xdeB\x19n\xbe\xe4.\xf2\x84\xb6x (esc) |
|
742 \x87\xcd\xc9n\x8e\xaa\xb6\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02H (esc) |
|
743 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc) |
|
744 |
|
745 $ hg unbundle2 < ../rev.hg2 |
|
746 adding changesets |
|
747 adding manifests |
|
748 adding file changes |
|
749 added 0 changesets with 0 changes to 3 files |
|
750 0 unread bytes |
|
751 addchangegroup return: 1 |
|
752 |
|
753 with reply |
|
754 |
|
755 $ hg bundle2 --rev '8+7+5+4' --reply ../rev-rr.hg2 |
|
756 $ hg unbundle2 ../rev-reply.hg2 < ../rev-rr.hg2 |
|
757 0 unread bytes |
|
758 addchangegroup return: 1 |
|
759 |
|
760 $ cat ../rev-reply.hg2 |
|
761 HG2X\x00\x00\x003\x15b2x:reply:changegroup\x00\x00\x00\x00\x00\x02\x0b\x01\x06\x01in-reply-to1return1\x00\x00\x00\x00\x00\x1f (esc) |
|
762 b2x:output\x00\x00\x00\x01\x00\x01\x0b\x01in-reply-to1\x00\x00\x00dadding changesets (esc) |
|
763 adding manifests |
|
764 adding file changes |
|
765 added 0 changesets with 0 changes to 3 files |
|
766 \x00\x00\x00\x00\x00\x00 (no-eol) (esc) |
|
767 |
|
768 $ cd .. |
|
769 |
|
770 Real world exchange |
|
771 ===================== |
|
772 |
|
773 Add more obsolescence information |
|
774 |
|
775 $ hg -R main debugobsolete -d '0 0' 1111111111111111111111111111111111111111 `getmainid 9520eea781bc` |
|
776 $ hg -R main debugobsolete -d '0 0' 2222222222222222222222222222222222222222 `getmainid 24b6387c8c8c` |
|
777 |
|
778 clone --pull |
|
779 |
|
780 $ hg -R main phase --public cd010b8cd998 |
|
781 $ hg clone main other --pull --rev 9520eea781bc |
|
782 adding changesets |
|
783 adding manifests |
|
784 adding file changes |
|
785 added 2 changesets with 2 changes to 2 files |
|
786 1 new obsolescence markers |
|
787 updating to branch default |
|
788 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
789 $ hg -R other log -G |
|
790 @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E |
|
791 | |
|
792 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A |
|
793 |
|
794 $ hg -R other debugobsolete |
|
795 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
796 |
|
797 pull |
|
798 |
|
799 $ hg -R main phase --public 9520eea781bc |
|
800 $ hg -R other pull -r 24b6387c8c8c |
|
801 pulling from $TESTTMP/main (glob) |
|
802 searching for changes |
|
803 adding changesets |
|
804 adding manifests |
|
805 adding file changes |
|
806 added 1 changesets with 1 changes to 1 files (+1 heads) |
|
807 1 new obsolescence markers |
|
808 (run 'hg heads' to see heads, 'hg merge' to merge) |
|
809 $ hg -R other log -G |
|
810 o 2:24b6387c8c8c draft Nicolas Dumazet <nicdumz.commits@gmail.com> F |
|
811 | |
|
812 | @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E |
|
813 |/ |
|
814 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A |
|
815 |
|
816 $ hg -R other debugobsolete |
|
817 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
818 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
819 |
|
820 pull empty (with phase movement) |
|
821 |
|
822 $ hg -R main phase --public 24b6387c8c8c |
|
823 $ hg -R other pull -r 24b6387c8c8c |
|
824 pulling from $TESTTMP/main (glob) |
|
825 no changes found |
|
826 $ hg -R other log -G |
|
827 o 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F |
|
828 | |
|
829 | @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E |
|
830 |/ |
|
831 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A |
|
832 |
|
833 $ hg -R other debugobsolete |
|
834 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
835 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
836 |
|
837 pull empty |
|
838 |
|
839 $ hg -R other pull -r 24b6387c8c8c |
|
840 pulling from $TESTTMP/main (glob) |
|
841 no changes found |
|
842 $ hg -R other log -G |
|
843 o 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F |
|
844 | |
|
845 | @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E |
|
846 |/ |
|
847 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A |
|
848 |
|
849 $ hg -R other debugobsolete |
|
850 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
851 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
852 |
|
853 add extra data to test their exchange during push |
|
854 |
|
855 $ hg -R main bookmark --rev eea13746799a book_eea1 |
|
856 $ hg -R main debugobsolete -d '0 0' 3333333333333333333333333333333333333333 `getmainid eea13746799a` |
|
857 $ hg -R main bookmark --rev 02de42196ebe book_02de |
|
858 $ hg -R main debugobsolete -d '0 0' 4444444444444444444444444444444444444444 `getmainid 02de42196ebe` |
|
859 $ hg -R main bookmark --rev 42ccdea3bb16 book_42cc |
|
860 $ hg -R main debugobsolete -d '0 0' 5555555555555555555555555555555555555555 `getmainid 42ccdea3bb16` |
|
861 $ hg -R main bookmark --rev 5fddd98957c8 book_5fdd |
|
862 $ hg -R main debugobsolete -d '0 0' 6666666666666666666666666666666666666666 `getmainid 5fddd98957c8` |
|
863 $ hg -R main bookmark --rev 32af7686d403 book_32af |
|
864 $ hg -R main debugobsolete -d '0 0' 7777777777777777777777777777777777777777 `getmainid 32af7686d403` |
|
865 |
|
866 $ hg -R other bookmark --rev cd010b8cd998 book_eea1 |
|
867 $ hg -R other bookmark --rev cd010b8cd998 book_02de |
|
868 $ hg -R other bookmark --rev cd010b8cd998 book_42cc |
|
869 $ hg -R other bookmark --rev cd010b8cd998 book_5fdd |
|
870 $ hg -R other bookmark --rev cd010b8cd998 book_32af |
|
871 |
|
872 $ hg -R main phase --public eea13746799a |
|
873 |
|
874 push |
|
875 $ hg -R main push other --rev eea13746799a --bookmark book_eea1 |
|
876 pushing to other |
|
877 searching for changes |
|
878 remote: adding changesets |
|
879 remote: adding manifests |
|
880 remote: adding file changes |
|
881 remote: added 1 changesets with 0 changes to 0 files (-1 heads) |
|
882 remote: 1 new obsolescence markers |
|
883 updating bookmark book_eea1 |
|
884 $ hg -R other log -G |
|
885 o 3:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> book_eea1 G |
|
886 |\ |
|
887 | o 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F |
|
888 | | |
|
889 @ | 1:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E |
|
890 |/ |
|
891 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_02de book_32af book_42cc book_5fdd A |
|
892 |
|
893 $ hg -R other debugobsolete |
|
894 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
895 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
896 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
897 |
|
898 pull over ssh |
|
899 |
|
900 $ hg -R other pull ssh://user@dummy/main -r 02de42196ebe --bookmark book_02de |
|
901 pulling from ssh://user@dummy/main |
|
902 searching for changes |
|
903 adding changesets |
|
904 adding manifests |
|
905 adding file changes |
|
906 added 1 changesets with 1 changes to 1 files (+1 heads) |
|
907 1 new obsolescence markers |
|
908 updating bookmark book_02de |
|
909 (run 'hg heads' to see heads, 'hg merge' to merge) |
|
910 $ hg -R other debugobsolete |
|
911 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
912 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
913 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
914 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
915 |
|
916 pull over http |
|
917 |
|
918 $ hg -R main serve -p $HGPORT -d --pid-file=main.pid -E main-error.log |
|
919 $ cat main.pid >> $DAEMON_PIDS |
|
920 |
|
921 $ hg -R other pull http://localhost:$HGPORT/ -r 42ccdea3bb16 --bookmark book_42cc |
|
922 pulling from http://localhost:$HGPORT/ |
|
923 searching for changes |
|
924 adding changesets |
|
925 adding manifests |
|
926 adding file changes |
|
927 added 1 changesets with 1 changes to 1 files (+1 heads) |
|
928 1 new obsolescence markers |
|
929 updating bookmark book_42cc |
|
930 (run 'hg heads .' to see heads, 'hg merge' to merge) |
|
931 $ cat main-error.log |
|
932 $ hg -R other debugobsolete |
|
933 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
934 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
935 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
936 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
937 5555555555555555555555555555555555555555 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
938 |
|
939 push over ssh |
|
940 |
|
941 $ hg -R main push ssh://user@dummy/other -r 5fddd98957c8 --bookmark book_5fdd |
|
942 pushing to ssh://user@dummy/other |
|
943 searching for changes |
|
944 remote: adding changesets |
|
945 remote: adding manifests |
|
946 remote: adding file changes |
|
947 remote: added 1 changesets with 1 changes to 1 files |
|
948 remote: 1 new obsolescence markers |
|
949 updating bookmark book_5fdd |
|
950 $ hg -R other log -G |
|
951 o 6:5fddd98957c8 draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_5fdd C |
|
952 | |
|
953 o 5:42ccdea3bb16 draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_42cc B |
|
954 | |
|
955 | o 4:02de42196ebe draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_02de H |
|
956 | | |
|
957 | | o 3:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> book_eea1 G |
|
958 | |/| |
|
959 | o | 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F |
|
960 |/ / |
|
961 | @ 1:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E |
|
962 |/ |
|
963 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_32af A |
|
964 |
|
965 $ hg -R other debugobsolete |
|
966 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
967 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
968 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
969 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
970 5555555555555555555555555555555555555555 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
971 6666666666666666666666666666666666666666 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
972 |
|
973 push over http |
|
974 |
|
975 $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log |
|
976 $ cat other.pid >> $DAEMON_PIDS |
|
977 |
|
978 $ hg -R main phase --public 32af7686d403 |
|
979 $ hg -R main push http://localhost:$HGPORT2/ -r 32af7686d403 --bookmark book_32af |
|
980 pushing to http://localhost:$HGPORT2/ |
|
981 searching for changes |
|
982 remote: adding changesets |
|
983 remote: adding manifests |
|
984 remote: adding file changes |
|
985 remote: added 1 changesets with 1 changes to 1 files |
|
986 remote: 1 new obsolescence markers |
|
987 updating bookmark book_32af |
|
988 $ cat other-error.log |
|
989 |
|
990 Check final content. |
|
991 |
|
992 $ hg -R other log -G |
|
993 o 7:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_32af D |
|
994 | |
|
995 o 6:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_5fdd C |
|
996 | |
|
997 o 5:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_42cc B |
|
998 | |
|
999 | o 4:02de42196ebe draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_02de H |
|
1000 | | |
|
1001 | | o 3:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> book_eea1 G |
|
1002 | |/| |
|
1003 | o | 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F |
|
1004 |/ / |
|
1005 | @ 1:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E |
|
1006 |/ |
|
1007 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A |
|
1008 |
|
1009 $ hg -R other debugobsolete |
|
1010 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
1011 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
1012 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
1013 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
1014 5555555555555555555555555555555555555555 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
1015 6666666666666666666666666666666666666666 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
1016 7777777777777777777777777777777777777777 32af7686d403cf45b5d95f2d70cebea587ac806a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
1017 |
|
1018 Error Handling |
|
1019 ============== |
|
1020 |
|
1021 Check that errors are properly returned to the client during push. |
|
1022 |
|
1023 Setting up |
|
1024 |
|
1025 $ cat > failpush.py << EOF |
|
1026 > """A small extension that makes push fails when using bundle2 |
|
1027 > |
|
1028 > used to test error handling in bundle2 |
|
1029 > """ |
|
1030 > |
|
1031 > from mercurial import util |
|
1032 > from mercurial import bundle2 |
|
1033 > from mercurial import exchange |
|
1034 > from mercurial import extensions |
|
1035 > |
|
1036 > def _pushbundle2failpart(pushop, bundler): |
|
1037 > reason = pushop.ui.config('failpush', 'reason', None) |
|
1038 > part = None |
|
1039 > if reason == 'abort': |
|
1040 > bundler.newpart('test:abort') |
|
1041 > if reason == 'unknown': |
|
1042 > bundler.newpart('TEST:UNKNOWN') |
|
1043 > if reason == 'race': |
|
1044 > # 20 Bytes of crap |
|
1045 > bundler.newpart('b2x:check:heads', data='01234567890123456789') |
|
1046 > |
|
1047 > @bundle2.parthandler("test:abort") |
|
1048 > def handleabort(op, part): |
|
1049 > raise util.Abort('Abandon ship!', hint="don't panic") |
|
1050 > |
|
1051 > def uisetup(ui): |
|
1052 > exchange.b2partsgenmapping['failpart'] = _pushbundle2failpart |
|
1053 > exchange.b2partsgenorder.insert(0, 'failpart') |
|
1054 > |
|
1055 > EOF |
|
1056 |
|
1057 $ cd main |
|
1058 $ hg up tip |
|
1059 3 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1060 $ echo 'I' > I |
|
1061 $ hg add I |
|
1062 $ hg ci -m 'I' |
|
1063 $ hg id |
|
1064 e7ec4e813ba6 tip |
|
1065 $ cd .. |
|
1066 |
|
1067 $ cat << EOF >> $HGRCPATH |
|
1068 > [extensions] |
|
1069 > failpush=$TESTTMP/failpush.py |
|
1070 > EOF |
|
1071 |
|
1072 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS |
|
1073 $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log |
|
1074 $ cat other.pid >> $DAEMON_PIDS |
|
1075 |
|
1076 Doing the actual push: Abort error |
|
1077 |
|
1078 $ cat << EOF >> $HGRCPATH |
|
1079 > [failpush] |
|
1080 > reason = abort |
|
1081 > EOF |
|
1082 |
|
1083 $ hg -R main push other -r e7ec4e813ba6 |
|
1084 pushing to other |
|
1085 searching for changes |
|
1086 abort: Abandon ship! |
|
1087 (don't panic) |
|
1088 [255] |
|
1089 |
|
1090 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6 |
|
1091 pushing to ssh://user@dummy/other |
|
1092 searching for changes |
|
1093 abort: Abandon ship! |
|
1094 (don't panic) |
|
1095 [255] |
|
1096 |
|
1097 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6 |
|
1098 pushing to http://localhost:$HGPORT2/ |
|
1099 searching for changes |
|
1100 abort: Abandon ship! |
|
1101 (don't panic) |
|
1102 [255] |
|
1103 |
|
1104 |
|
1105 Doing the actual push: unknown mandatory parts |
|
1106 |
|
1107 $ cat << EOF >> $HGRCPATH |
|
1108 > [failpush] |
|
1109 > reason = unknown |
|
1110 > EOF |
|
1111 |
|
1112 $ hg -R main push other -r e7ec4e813ba6 |
|
1113 pushing to other |
|
1114 searching for changes |
|
1115 abort: missing support for test:unknown |
|
1116 [255] |
|
1117 |
|
1118 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6 |
|
1119 pushing to ssh://user@dummy/other |
|
1120 searching for changes |
|
1121 abort: missing support for test:unknown |
|
1122 [255] |
|
1123 |
|
1124 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6 |
|
1125 pushing to http://localhost:$HGPORT2/ |
|
1126 searching for changes |
|
1127 abort: missing support for test:unknown |
|
1128 [255] |
|
1129 |
|
1130 Doing the actual push: race |
|
1131 |
|
1132 $ cat << EOF >> $HGRCPATH |
|
1133 > [failpush] |
|
1134 > reason = race |
|
1135 > EOF |
|
1136 |
|
1137 $ hg -R main push other -r e7ec4e813ba6 |
|
1138 pushing to other |
|
1139 searching for changes |
|
1140 abort: push failed: |
|
1141 'repository changed while pushing - please try again' |
|
1142 [255] |
|
1143 |
|
1144 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6 |
|
1145 pushing to ssh://user@dummy/other |
|
1146 searching for changes |
|
1147 abort: push failed: |
|
1148 'repository changed while pushing - please try again' |
|
1149 [255] |
|
1150 |
|
1151 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6 |
|
1152 pushing to http://localhost:$HGPORT2/ |
|
1153 searching for changes |
|
1154 abort: push failed: |
|
1155 'repository changed while pushing - please try again' |
|
1156 [255] |
|
1157 |
|
1158 Doing the actual push: hook abort |
|
1159 |
|
1160 $ cat << EOF >> $HGRCPATH |
|
1161 > [failpush] |
|
1162 > reason = |
|
1163 > [hooks] |
|
1164 > b2x-pretransactionclose.failpush = false |
|
1165 > EOF |
|
1166 |
|
1167 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS |
|
1168 $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log |
|
1169 $ cat other.pid >> $DAEMON_PIDS |
|
1170 |
|
1171 $ hg -R main push other -r e7ec4e813ba6 |
|
1172 pushing to other |
|
1173 searching for changes |
|
1174 transaction abort! |
|
1175 rollback completed |
|
1176 abort: b2x-pretransactionclose.failpush hook exited with status 1 |
|
1177 [255] |
|
1178 |
|
1179 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6 |
|
1180 pushing to ssh://user@dummy/other |
|
1181 searching for changes |
|
1182 abort: b2x-pretransactionclose.failpush hook exited with status 1 |
|
1183 remote: transaction abort! |
|
1184 remote: rollback completed |
|
1185 [255] |
|
1186 |
|
1187 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6 |
|
1188 pushing to http://localhost:$HGPORT2/ |
|
1189 searching for changes |
|
1190 abort: b2x-pretransactionclose.failpush hook exited with status 1 |
|
1191 [255] |
|
1192 |
|
1193 |
|