121 heads = encodelist(heads) |
121 heads = encodelist(heads) |
122 f = self._callstream("changegroupsubset", |
122 f = self._callstream("changegroupsubset", |
123 bases=bases, heads=heads) |
123 bases=bases, heads=heads) |
124 return changegroupmod.unbundle10(self._decompress(f), 'UN') |
124 return changegroupmod.unbundle10(self._decompress(f), 'UN') |
125 |
125 |
|
126 def getbundle(self, source, heads=None, common=None): |
|
127 self.requirecap('getbundle', _('look up remote changes')) |
|
128 opts = {} |
|
129 if heads is not None: |
|
130 opts['heads'] = encodelist(heads) |
|
131 if common is not None: |
|
132 opts['common'] = encodelist(common) |
|
133 f = self._callstream("getbundle", **opts) |
|
134 return changegroupmod.unbundle10(self._decompress(f), 'UN') |
|
135 |
126 def unbundle(self, cg, heads, source): |
136 def unbundle(self, cg, heads, source): |
127 '''Send cg (a readable file-like object representing the |
137 '''Send cg (a readable file-like object representing the |
128 changegroup to push, typically a chunkbuffer object) to the |
138 changegroup to push, typically a chunkbuffer object) to the |
129 remote server as a bundle. Return an integer indicating the |
139 remote server as a bundle. Return an integer indicating the |
130 result of the push (see localrepository.addchangegroup()).''' |
140 result of the push (see localrepository.addchangegroup()).''' |
204 for b in repo.branches(nodes): |
214 for b in repo.branches(nodes): |
205 r.append(encodelist(b) + "\n") |
215 r.append(encodelist(b) + "\n") |
206 return "".join(r) |
216 return "".join(r) |
207 |
217 |
208 def capabilities(repo, proto): |
218 def capabilities(repo, proto): |
209 caps = 'lookup changegroupsubset branchmap pushkey known'.split() |
219 caps = 'lookup changegroupsubset branchmap pushkey known getbundle'.split() |
210 if _allowstream(repo.ui): |
220 if _allowstream(repo.ui): |
211 requiredformats = repo.requirements & repo.supportedformats |
221 requiredformats = repo.requirements & repo.supportedformats |
212 # if our local revlogs are just revlogv1, add 'stream' cap |
222 # if our local revlogs are just revlogv1, add 'stream' cap |
213 if not requiredformats - set(('revlogv1',)): |
223 if not requiredformats - set(('revlogv1',)): |
214 caps.append('stream') |
224 caps.append('stream') |
231 |
241 |
232 def debugwireargs(repo, proto, one, two, others): |
242 def debugwireargs(repo, proto, one, two, others): |
233 # only accept optional args from the known set |
243 # only accept optional args from the known set |
234 opts = options('debugwireargs', ['three', 'four'], others) |
244 opts = options('debugwireargs', ['three', 'four'], others) |
235 return repo.debugwireargs(one, two, **opts) |
245 return repo.debugwireargs(one, two, **opts) |
|
246 |
|
247 def getbundle(repo, proto, others): |
|
248 opts = options('getbundle', ['heads', 'common'], others) |
|
249 for k, v in opts.iteritems(): |
|
250 opts[k] = decodelist(v) |
|
251 cg = repo.getbundle('serve', **opts) |
|
252 return streamres(proto.groupchunks(cg)) |
236 |
253 |
237 def heads(repo, proto): |
254 def heads(repo, proto): |
238 h = repo.heads() |
255 h = repo.heads() |
239 return encodelist(h) + "\n" |
256 return encodelist(h) + "\n" |
240 |
257 |
380 'branches': (branches, 'nodes'), |
397 'branches': (branches, 'nodes'), |
381 'capabilities': (capabilities, ''), |
398 'capabilities': (capabilities, ''), |
382 'changegroup': (changegroup, 'roots'), |
399 'changegroup': (changegroup, 'roots'), |
383 'changegroupsubset': (changegroupsubset, 'bases heads'), |
400 'changegroupsubset': (changegroupsubset, 'bases heads'), |
384 'debugwireargs': (debugwireargs, 'one two *'), |
401 'debugwireargs': (debugwireargs, 'one two *'), |
|
402 'getbundle': (getbundle, '*'), |
385 'heads': (heads, ''), |
403 'heads': (heads, ''), |
386 'hello': (hello, ''), |
404 'hello': (hello, ''), |
387 'known': (known, 'nodes'), |
405 'known': (known, 'nodes'), |
388 'listkeys': (listkeys, 'namespace'), |
406 'listkeys': (listkeys, 'namespace'), |
389 'lookup': (lookup, 'key'), |
407 'lookup': (lookup, 'key'), |