Show More
@@ -552,3 +552,34 b' def _pullobsolete(pullop):' | |||
|
552 | 552 | pullop.repo.invalidatevolatilesets() |
|
553 | 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) |
@@ -105,8 +105,8 b' class localpeer(peer.peerrepository):' | |||
|
105 | 105 | |
|
106 | 106 | def getbundle(self, source, heads=None, common=None, bundlecaps=None, |
|
107 | 107 | format='HG10'): |
|
108 |
return change |
|
|
109 |
|
|
|
108 | return exchange.getbundle(self._repo, source, heads=heads, | |
|
109 | common=common, bundlecaps=bundlecaps) | |
|
110 | 110 | |
|
111 | 111 | # TODO We might want to move the next two calls into legacypeer and add |
|
112 | 112 | # unbundle instead. |
General Comments 0
You need to be logged in to leave comments.
Login now