299 return wireprototypes.streamres(gen=stream, prefer_uncompressed=True) |
299 return wireprototypes.streamres(gen=stream, prefer_uncompressed=True) |
300 |
300 |
301 |
301 |
302 @wireprotocommand(b'clonebundles', b'', permission=b'pull') |
302 @wireprotocommand(b'clonebundles', b'', permission=b'pull') |
303 def clonebundles(repo, proto): |
303 def clonebundles(repo, proto): |
304 """Server command for returning info for available bundles to seed clones. |
304 """A legacy version of clonebundles_manifest |
305 |
305 |
306 Clients will parse this response and determine what bundle to fetch. |
306 This version filtered out new url scheme (like peer-bundle-cache://) to |
307 |
307 avoid confusion in older clients. |
308 Extensions may wrap this command to filter or dynamically emit data |
|
309 depending on the request. e.g. you could advertise URLs for the closest |
|
310 data center given the client's IP address. |
|
311 |
|
312 The only filter on the server side is filtering out inline clonebundles |
|
313 in case a client does not support them. |
|
314 Otherwise, older clients would retrieve and error out on those. |
|
315 """ |
308 """ |
316 manifest_contents = bundlecaches.get_manifest(repo) |
309 manifest_contents = bundlecaches.get_manifest(repo) |
317 clientcapabilities = proto.getprotocaps() |
310 # Filter out peer-bundle-cache:// entries |
318 if b'inlineclonebundles' in clientcapabilities: |
|
319 return wireprototypes.bytesresponse(manifest_contents) |
|
320 modified_manifest = [] |
311 modified_manifest = [] |
321 for line in manifest_contents.splitlines(): |
312 for line in manifest_contents.splitlines(): |
322 if line.startswith(bundlecaches.CLONEBUNDLESCHEME): |
313 if line.startswith(bundlecaches.CLONEBUNDLESCHEME): |
323 continue |
314 continue |
324 modified_manifest.append(line) |
315 modified_manifest.append(line) |
325 return wireprototypes.bytesresponse(b'\n'.join(modified_manifest)) |
316 return wireprototypes.bytesresponse(b'\n'.join(modified_manifest)) |
|
317 |
|
318 |
|
319 @wireprotocommand(b'clonebundles_manifest', b'*', permission=b'pull') |
|
320 def clonebundles_2(repo, proto, args): |
|
321 """Server command for returning info for available bundles to seed clones. |
|
322 |
|
323 Clients will parse this response and determine what bundle to fetch. |
|
324 |
|
325 Extensions may wrap this command to filter or dynamically emit data |
|
326 depending on the request. e.g. you could advertise URLs for the closest |
|
327 data center given the client's IP address. |
|
328 |
|
329 The only filter on the server side is filtering out inline clonebundles |
|
330 in case a client does not support them. |
|
331 Otherwise, older clients would retrieve and error out on those. |
|
332 """ |
|
333 manifest_contents = bundlecaches.get_manifest(repo) |
|
334 return wireprototypes.bytesresponse(manifest_contents) |
326 |
335 |
327 |
336 |
328 wireprotocaps = [ |
337 wireprotocaps = [ |
329 b'lookup', |
338 b'lookup', |
330 b'branchmap', |
339 b'branchmap', |