147 def known(self, nodes): |
147 def known(self, nodes): |
148 return self._repo.known(nodes) |
148 return self._repo.known(nodes) |
149 |
149 |
150 def getbundle(self, source, heads=None, common=None, bundlecaps=None, |
150 def getbundle(self, source, heads=None, common=None, bundlecaps=None, |
151 **kwargs): |
151 **kwargs): |
152 cg = exchange.getbundle(self._repo, source, heads=heads, |
152 chunks = exchange.getbundlechunks(self._repo, source, heads=heads, |
153 common=common, bundlecaps=bundlecaps, **kwargs) |
153 common=common, bundlecaps=bundlecaps, |
|
154 **kwargs) |
|
155 cb = util.chunkbuffer(chunks) |
|
156 |
154 if bundlecaps is not None and 'HG20' in bundlecaps: |
157 if bundlecaps is not None and 'HG20' in bundlecaps: |
155 # When requesting a bundle2, getbundle returns a stream to make the |
158 # When requesting a bundle2, getbundle returns a stream to make the |
156 # wire level function happier. We need to build a proper object |
159 # wire level function happier. We need to build a proper object |
157 # from it in local peer. |
160 # from it in local peer. |
158 cg = bundle2.getunbundler(self.ui, cg) |
161 return bundle2.getunbundler(self.ui, cb) |
159 return cg |
162 else: |
|
163 return changegroup.getunbundler('01', cb, None) |
160 |
164 |
161 # TODO We might want to move the next two calls into legacypeer and add |
165 # TODO We might want to move the next two calls into legacypeer and add |
162 # unbundle instead. |
166 # unbundle instead. |
163 |
167 |
164 def unbundle(self, cg, heads, url): |
168 def unbundle(self, cg, heads, url): |