550 data = base85.b85decode(remoteobs[key]) |
550 data = base85.b85decode(remoteobs[key]) |
551 pullop.repo.obsstore.mergemarkers(tr, data) |
551 pullop.repo.obsstore.mergemarkers(tr, data) |
552 pullop.repo.invalidatevolatilesets() |
552 pullop.repo.invalidatevolatilesets() |
553 return tr |
553 return tr |
554 |
554 |
|
555 def getbundle(repo, source, heads=None, common=None, bundlecaps=None): |
|
556 """return a full bundle (with potentially multiple kind of parts) |
|
557 |
|
558 Could be a bundle HG10 or a bundle HG20 depending on bundlecaps |
|
559 passed. For now, the bundle can contain only changegroup, but this will |
|
560 changes when more part type will be available for bundle2. |
|
561 |
|
562 This is different from changegroup.getbundle that only returns an HG10 |
|
563 changegroup bundle. They may eventually get reunited in the future when we |
|
564 have a clearer idea of the API we what to query different data. |
|
565 |
|
566 The implementation is at a very early stage and will get massive rework |
|
567 when the API of bundle is refined. |
|
568 """ |
|
569 # build bundle here. |
|
570 cg = changegroup.getbundle(repo, source, heads=heads, |
|
571 common=common, bundlecaps=None) |
|
572 if bundlecaps is None or 'HG20' not in bundlecaps: |
|
573 return cg |
|
574 # very crude first implementation, |
|
575 # the bundle API will change and the generation will be done lazily. |
|
576 bundler = bundle2.bundle20(repo.ui) |
|
577 tempname = changegroup.writebundle(cg, None, 'HG10UN') |
|
578 data = open(tempname).read() |
|
579 part = bundle2.part('changegroup', data=data) |
|
580 bundler.addpart(part) |
|
581 temp = cStringIO.StringIO() |
|
582 for c in bundler.getchunks(): |
|
583 temp.write(c) |
|
584 temp.seek(0) |
|
585 return bundle2.unbundle20(repo.ui, temp) |