Show More
@@ -64,7 +64,8 b' def pull(pullop):' | |||
|
64 | 64 | # Find all file nodes referenced by added manifests and fetch those |
|
65 | 65 | # revisions. |
|
66 | 66 | fnodes = _derivefilesfrommanifests(repo, manres['added']) |
|
67 |
_fetchfiles(repo, tr, remote, fnodes, |
|
|
67 | _fetchfilesfromcsets(repo, tr, remote, fnodes, csetres['added'], | |
|
68 | manres['linkrevs']) | |
|
68 | 69 | |
|
69 | 70 | def _pullchangesetdiscovery(repo, remote, heads, abortwhenunrelated=True): |
|
70 | 71 | """Determine which changesets need to be pulled.""" |
@@ -346,6 +347,7 b' def _derivefilesfrommanifests(repo, mani' | |||
|
346 | 347 | return fnodes |
|
347 | 348 | |
|
348 | 349 | def _fetchfiles(repo, tr, remote, fnodes, linkrevs): |
|
350 | """Fetch file data from explicit file revisions.""" | |
|
349 | 351 | def iterrevisions(objs, progress): |
|
350 | 352 | for filerevision in objs: |
|
351 | 353 | node = filerevision[b'node'] |
@@ -418,3 +420,84 b' def _fetchfiles(repo, tr, remote, fnodes' | |||
|
418 | 420 | iterrevisions(objs, progress), |
|
419 | 421 | locallinkrevs[path].__getitem__, |
|
420 | 422 | weakref.proxy(tr)) |
|
423 | ||
|
424 | def _fetchfilesfromcsets(repo, tr, remote, fnodes, csets, manlinkrevs): | |
|
425 | """Fetch file data from explicit changeset revisions.""" | |
|
426 | ||
|
427 | def iterrevisions(objs, remaining, progress): | |
|
428 | while remaining: | |
|
429 | filerevision = next(objs) | |
|
430 | ||
|
431 | node = filerevision[b'node'] | |
|
432 | ||
|
433 | extrafields = {} | |
|
434 | ||
|
435 | for field, size in filerevision.get(b'fieldsfollowing', []): | |
|
436 | extrafields[field] = next(objs) | |
|
437 | ||
|
438 | if b'delta' in extrafields: | |
|
439 | basenode = filerevision[b'deltabasenode'] | |
|
440 | delta = extrafields[b'delta'] | |
|
441 | elif b'revision' in extrafields: | |
|
442 | basenode = nullid | |
|
443 | revision = extrafields[b'revision'] | |
|
444 | delta = mdiff.trivialdiffheader(len(revision)) + revision | |
|
445 | else: | |
|
446 | continue | |
|
447 | ||
|
448 | yield ( | |
|
449 | node, | |
|
450 | filerevision[b'parents'][0], | |
|
451 | filerevision[b'parents'][1], | |
|
452 | node, | |
|
453 | basenode, | |
|
454 | delta, | |
|
455 | # Flags not yet supported. | |
|
456 | 0, | |
|
457 | ) | |
|
458 | ||
|
459 | progress.increment() | |
|
460 | remaining -= 1 | |
|
461 | ||
|
462 | progress = repo.ui.makeprogress( | |
|
463 | _('files'), unit=_('chunks'), | |
|
464 | total=sum(len(v) for v in fnodes.itervalues())) | |
|
465 | ||
|
466 | commandmeta = remote.apidescriptor[b'commands'][b'filesdata'] | |
|
467 | batchsize = commandmeta.get(b'recommendedbatchsize', 50000) | |
|
468 | ||
|
469 | for i in pycompat.xrange(0, len(csets), batchsize): | |
|
470 | batch = [x for x in csets[i:i + batchsize]] | |
|
471 | if not batch: | |
|
472 | continue | |
|
473 | ||
|
474 | with remote.commandexecutor() as e: | |
|
475 | args = { | |
|
476 | b'revisions': [{ | |
|
477 | b'type': b'changesetexplicit', | |
|
478 | b'nodes': batch, | |
|
479 | }], | |
|
480 | b'fields': {b'parents', b'revision'}, | |
|
481 | b'haveparents': True, | |
|
482 | } | |
|
483 | ||
|
484 | objs = e.callcommand(b'filesdata', args).result() | |
|
485 | ||
|
486 | # First object is an overall header. | |
|
487 | overall = next(objs) | |
|
488 | ||
|
489 | # We have overall['totalpaths'] segments. | |
|
490 | for i in pycompat.xrange(overall[b'totalpaths']): | |
|
491 | header = next(objs) | |
|
492 | ||
|
493 | path = header[b'path'] | |
|
494 | store = repo.file(path) | |
|
495 | ||
|
496 | linkrevs = { | |
|
497 | fnode: manlinkrevs[mnode] | |
|
498 | for fnode, mnode in fnodes[path].iteritems()} | |
|
499 | ||
|
500 | store.addgroup(iterrevisions(objs, header[b'totalitems'], | |
|
501 | progress), | |
|
502 | linkrevs.__getitem__, | |
|
503 | weakref.proxy(tr)) |
@@ -101,40 +101,30 b' Test basic clone' | |||
|
101 | 101 | received frame(size=11; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation) |
|
102 | 102 | received frame(size=992; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation) |
|
103 | 103 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) |
|
104 |
sending |
|
|
105 | sending command filedata: { | |
|
104 | sending 1 commands | |
|
105 | sending command filesdata: { | |
|
106 | 106 | 'fields': set([ |
|
107 | 107 | 'parents', |
|
108 | 108 | 'revision' |
|
109 | 109 | ]), |
|
110 | 110 | 'haveparents': True, |
|
111 |
' |
|
|
112 | '+N\xb0s\x19\xbf\xa0w\xa4\n/\x04\x916Y\xae\xf0\xdaB\xda', | |
|
113 | '\x9a8\x12)\x97\xb3\xac\x97\xbe*\x9a\xa2\xe5V\x83\x83A\xfd\xf2\xcc', | |
|
114 | '\xc2\xa2\x05\xc8\xb2\xad\xe2J\xf2`b\xe5<\xd5\xbc8\x01\xd6`\xda' | |
|
115 | ], | |
|
116 | 'path': 'a' | |
|
117 | } | |
|
118 | sending command filedata: { | |
|
119 | 'fields': set([ | |
|
120 | 'parents', | |
|
121 | 'revision' | |
|
122 |
] |
|
|
123 | 'haveparents': True, | |
|
124 | 'nodes': [ | |
|
125 | '\x81\x9e%\x8d1\xa5\xe1`f)\xf3e\xbb\x90*\x1b!\xeeB\x16', | |
|
126 | '\xb1zk\xd3g=\x9a\xb8\xce\xd5\x81\xa2\t\xf6/=\xa5\xccEx', | |
|
127 | '\xc5\xb1\xf9\xd3n\x1c\xc18\xbf\xb6\xef\xb3\xde\xb7]\x8c\xcad\x94\xc3' | |
|
128 | ], | |
|
129 | 'path': 'b' | |
|
111 | 'revisions': [ | |
|
112 | { | |
|
113 | 'nodes': [ | |
|
114 | '3\x90\xef\x85\x00s\xfb\xc2\xf0\xdf\xff"D4,\x8e\x92)\x01:', | |
|
115 | 'D2\xd86&\xe8\xa9\x86U\xf0b\xec\x1f*C\xb0\x7f\x7f\xbb\xb0', | |
|
116 | '\xcd%4vk\xec\xe18\xc7\xc1\xaf\xdch%0/\x0fb\xd8\x1f', | |
|
117 | '\xe9j\xe2\x0fA\x88H{\x9a\xe4\xef9A\xc2|\x81\x141F\xe5', | |
|
118 | '\xca\xa2\xa4eE\x1d\xd1\xfa\xcd\xa0\xf5\xb1#\x12\xc3UXA\x88\xa1' | |
|
119 | ], | |
|
120 | 'type': 'changesetexplicit' | |
|
121 | } | |
|
122 | ] | |
|
130 | 123 | } |
|
131 | 124 | received frame(size=9; request=1; stream=2; streamflags=stream-begin; type=stream-settings; flags=eos) |
|
132 | 125 | received frame(size=11; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation) |
|
133 |
received frame(size= |
|
|
126 | received frame(size=901; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation) | |
|
134 | 127 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) |
|
135 | received frame(size=11; request=3; stream=2; streamflags=encoded; type=command-response; flags=continuation) | |
|
136 | received frame(size=431; request=3; stream=2; streamflags=encoded; type=command-response; flags=continuation) | |
|
137 | received frame(size=0; request=3; stream=2; streamflags=; type=command-response; flags=eos) | |
|
138 | 128 | updating the branch cache |
|
139 | 129 | new changesets 3390ef850073:caa2a465451d (3 drafts) |
|
140 | 130 | (sent 5 HTTP requests and * bytes; received * bytes in responses) (glob) |
@@ -239,37 +229,27 b' Cloning only a specific revision works' | |||
|
239 | 229 | received frame(size=11; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation) |
|
240 | 230 | received frame(size=404; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation) |
|
241 | 231 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) |
|
242 |
sending |
|
|
243 | sending command filedata: { | |
|
232 | sending 1 commands | |
|
233 | sending command filesdata: { | |
|
244 | 234 | 'fields': set([ |
|
245 | 235 | 'parents', |
|
246 | 236 | 'revision' |
|
247 | 237 | ]), |
|
248 | 238 | 'haveparents': True, |
|
249 |
' |
|
|
250 | '+N\xb0s\x19\xbf\xa0w\xa4\n/\x04\x916Y\xae\xf0\xdaB\xda', | |
|
251 | '\x9a8\x12)\x97\xb3\xac\x97\xbe*\x9a\xa2\xe5V\x83\x83A\xfd\xf2\xcc' | |
|
252 | ], | |
|
253 | 'path': 'a' | |
|
254 | } | |
|
255 | sending command filedata: { | |
|
256 | 'fields': set([ | |
|
257 | 'parents', | |
|
258 | 'revision' | |
|
259 | ]), | |
|
260 | 'haveparents': True, | |
|
261 | 'nodes': [ | |
|
262 | '\x81\x9e%\x8d1\xa5\xe1`f)\xf3e\xbb\x90*\x1b!\xeeB\x16' | |
|
263 | ], | |
|
264 | 'path': 'b' | |
|
239 | 'revisions': [ | |
|
240 | { | |
|
241 | 'nodes': [ | |
|
242 | '3\x90\xef\x85\x00s\xfb\xc2\xf0\xdf\xff"D4,\x8e\x92)\x01:', | |
|
243 | 'D2\xd86&\xe8\xa9\x86U\xf0b\xec\x1f*C\xb0\x7f\x7f\xbb\xb0' | |
|
244 | ], | |
|
245 | 'type': 'changesetexplicit' | |
|
246 | } | |
|
247 | ] | |
|
265 | 248 | } |
|
266 | 249 | received frame(size=9; request=1; stream=2; streamflags=stream-begin; type=stream-settings; flags=eos) |
|
267 | 250 | received frame(size=11; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation) |
|
268 |
received frame(size= |
|
|
251 | received frame(size=439; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation) | |
|
269 | 252 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) |
|
270 | received frame(size=11; request=3; stream=2; streamflags=encoded; type=command-response; flags=continuation) | |
|
271 | received frame(size=123; request=3; stream=2; streamflags=encoded; type=command-response; flags=continuation) | |
|
272 | received frame(size=0; request=3; stream=2; streamflags=; type=command-response; flags=eos) | |
|
273 | 253 | updating the branch cache |
|
274 | 254 | new changesets 3390ef850073:4432d83626e8 |
|
275 | 255 | (sent 6 HTTP requests and * bytes; received * bytes in responses) (glob) |
@@ -357,39 +337,28 b' Incremental pull works' | |||
|
357 | 337 | received frame(size=11; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation) |
|
358 | 338 | received frame(size=601; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation) |
|
359 | 339 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) |
|
360 |
sending |
|
|
361 | sending command filedata: { | |
|
340 | sending 1 commands | |
|
341 | sending command filesdata: { | |
|
362 | 342 | 'fields': set([ |
|
363 | 343 | 'parents', |
|
364 | 344 | 'revision' |
|
365 | 345 | ]), |
|
366 | 346 | 'haveparents': True, |
|
367 |
' |
|
|
368 | '+N\xb0s\x19\xbf\xa0w\xa4\n/\x04\x916Y\xae\xf0\xdaB\xda', | |
|
369 | '\xc2\xa2\x05\xc8\xb2\xad\xe2J\xf2`b\xe5<\xd5\xbc8\x01\xd6`\xda' | |
|
370 | ], | |
|
371 | 'path': 'a' | |
|
372 | } | |
|
373 | sending command filedata: { | |
|
374 | 'fields': set([ | |
|
375 | 'parents', | |
|
376 | 'revision' | |
|
377 | ]), | |
|
378 | 'haveparents': True, | |
|
379 | 'nodes': [ | |
|
380 | '\x81\x9e%\x8d1\xa5\xe1`f)\xf3e\xbb\x90*\x1b!\xeeB\x16', | |
|
381 | '\xb1zk\xd3g=\x9a\xb8\xce\xd5\x81\xa2\t\xf6/=\xa5\xccEx', | |
|
382 | '\xc5\xb1\xf9\xd3n\x1c\xc18\xbf\xb6\xef\xb3\xde\xb7]\x8c\xcad\x94\xc3' | |
|
383 | ], | |
|
384 | 'path': 'b' | |
|
347 | 'revisions': [ | |
|
348 | { | |
|
349 | 'nodes': [ | |
|
350 | '\xcd%4vk\xec\xe18\xc7\xc1\xaf\xdch%0/\x0fb\xd8\x1f', | |
|
351 | '\xe9j\xe2\x0fA\x88H{\x9a\xe4\xef9A\xc2|\x81\x141F\xe5', | |
|
352 | '\xca\xa2\xa4eE\x1d\xd1\xfa\xcd\xa0\xf5\xb1#\x12\xc3UXA\x88\xa1' | |
|
353 | ], | |
|
354 | 'type': 'changesetexplicit' | |
|
355 | } | |
|
356 | ] | |
|
385 | 357 | } |
|
386 | 358 | received frame(size=9; request=1; stream=2; streamflags=stream-begin; type=stream-settings; flags=eos) |
|
387 | 359 | received frame(size=11; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation) |
|
388 |
received frame(size=27 |
|
|
360 | received frame(size=527; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation) | |
|
389 | 361 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) |
|
390 | received frame(size=11; request=3; stream=2; streamflags=encoded; type=command-response; flags=continuation) | |
|
391 | received frame(size=431; request=3; stream=2; streamflags=encoded; type=command-response; flags=continuation) | |
|
392 | received frame(size=0; request=3; stream=2; streamflags=; type=command-response; flags=eos) | |
|
393 | 362 | updating the branch cache |
|
394 | 363 | new changesets cd2534766bec:caa2a465451d (3 drafts) |
|
395 | 364 | (run 'hg update' to get a working copy) |
@@ -557,40 +526,30 b' Bookmarks are transferred on clone' | |||
|
557 | 526 | received frame(size=11; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation) |
|
558 | 527 | received frame(size=992; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation) |
|
559 | 528 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) |
|
560 |
sending |
|
|
561 | sending command filedata: { | |
|
529 | sending 1 commands | |
|
530 | sending command filesdata: { | |
|
562 | 531 | 'fields': set([ |
|
563 | 532 | 'parents', |
|
564 | 533 | 'revision' |
|
565 | 534 | ]), |
|
566 | 535 | 'haveparents': True, |
|
567 |
' |
|
|
568 | '+N\xb0s\x19\xbf\xa0w\xa4\n/\x04\x916Y\xae\xf0\xdaB\xda', | |
|
569 | '\x9a8\x12)\x97\xb3\xac\x97\xbe*\x9a\xa2\xe5V\x83\x83A\xfd\xf2\xcc', | |
|
570 | '\xc2\xa2\x05\xc8\xb2\xad\xe2J\xf2`b\xe5<\xd5\xbc8\x01\xd6`\xda' | |
|
571 | ], | |
|
572 | 'path': 'a' | |
|
573 | } | |
|
574 | sending command filedata: { | |
|
575 | 'fields': set([ | |
|
576 | 'parents', | |
|
577 | 'revision' | |
|
578 |
] |
|
|
579 | 'haveparents': True, | |
|
580 | 'nodes': [ | |
|
581 | '\x81\x9e%\x8d1\xa5\xe1`f)\xf3e\xbb\x90*\x1b!\xeeB\x16', | |
|
582 | '\xb1zk\xd3g=\x9a\xb8\xce\xd5\x81\xa2\t\xf6/=\xa5\xccEx', | |
|
583 | '\xc5\xb1\xf9\xd3n\x1c\xc18\xbf\xb6\xef\xb3\xde\xb7]\x8c\xcad\x94\xc3' | |
|
584 | ], | |
|
585 | 'path': 'b' | |
|
536 | 'revisions': [ | |
|
537 | { | |
|
538 | 'nodes': [ | |
|
539 | '3\x90\xef\x85\x00s\xfb\xc2\xf0\xdf\xff"D4,\x8e\x92)\x01:', | |
|
540 | 'D2\xd86&\xe8\xa9\x86U\xf0b\xec\x1f*C\xb0\x7f\x7f\xbb\xb0', | |
|
541 | '\xcd%4vk\xec\xe18\xc7\xc1\xaf\xdch%0/\x0fb\xd8\x1f', | |
|
542 | '\xe9j\xe2\x0fA\x88H{\x9a\xe4\xef9A\xc2|\x81\x141F\xe5', | |
|
543 | '\xca\xa2\xa4eE\x1d\xd1\xfa\xcd\xa0\xf5\xb1#\x12\xc3UXA\x88\xa1' | |
|
544 | ], | |
|
545 | 'type': 'changesetexplicit' | |
|
546 | } | |
|
547 | ] | |
|
586 | 548 | } |
|
587 | 549 | received frame(size=9; request=1; stream=2; streamflags=stream-begin; type=stream-settings; flags=eos) |
|
588 | 550 | received frame(size=11; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation) |
|
589 |
received frame(size= |
|
|
551 | received frame(size=901; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation) | |
|
590 | 552 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) |
|
591 | received frame(size=11; request=3; stream=2; streamflags=encoded; type=command-response; flags=continuation) | |
|
592 | received frame(size=431; request=3; stream=2; streamflags=encoded; type=command-response; flags=continuation) | |
|
593 | received frame(size=0; request=3; stream=2; streamflags=; type=command-response; flags=eos) | |
|
594 | 553 | updating the branch cache |
|
595 | 554 | new changesets 3390ef850073:caa2a465451d (1 drafts) |
|
596 | 555 | (sent 5 HTTP requests and * bytes; received * bytes in responses) (glob) |
General Comments 0
You need to be logged in to leave comments.
Login now