##// END OF EJS Templates
clonebundles: introduce a new write protocol command...
marmoute -
r51594:4238e6b2 default
parent child Browse files
Show More
@@ -324,6 +324,7 b' def capabilities(orig, repo, proto):'
324 # missing file.
324 # missing file.
325 if repo.vfs.exists(bundlecaches.CB_MANIFEST_FILE):
325 if repo.vfs.exists(bundlecaches.CB_MANIFEST_FILE):
326 caps.append(b'clonebundles')
326 caps.append(b'clonebundles')
327 caps.append(b'clonebundles_manifest')
327
328
328 return caps
329 return caps
329
330
@@ -338,8 +338,11 b' class wirepeer(repository.peer):'
338 # Begin of ipeercommands interface.
338 # Begin of ipeercommands interface.
339
339
340 def clonebundles(self):
340 def clonebundles(self):
341 self.requirecap(b'clonebundles', _(b'clone bundles'))
341 if self.capable(b'clonebundles_manifest'):
342 return self._call(b'clonebundles')
342 return self._call(b'clonebundles_manifest')
343 else:
344 self.requirecap(b'clonebundles', _(b'clone bundles'))
345 return self._call(b'clonebundles')
343
346
344 def _finish_inline_clone_bundle(self, stream):
347 def _finish_inline_clone_bundle(self, stream):
345 pass # allow override for httppeer
348 pass # allow override for httppeer
@@ -301,6 +301,23 b' def get_cached_bundle_inline(repo, proto'
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 """A legacy version of clonebundles_manifest
305
306 This version filtered out new url scheme (like peer-bundle-cache://) to
307 avoid confusion in older clients.
308 """
309 manifest_contents = bundlecaches.get_manifest(repo)
310 # Filter out peer-bundle-cache:// entries
311 modified_manifest = []
312 for line in manifest_contents.splitlines():
313 if line.startswith(bundlecaches.CLONEBUNDLESCHEME):
314 continue
315 modified_manifest.append(line)
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):
304 """Server command for returning info for available bundles to seed clones.
321 """Server command for returning info for available bundles to seed clones.
305
322
306 Clients will parse this response and determine what bundle to fetch.
323 Clients will parse this response and determine what bundle to fetch.
@@ -314,15 +331,7 b' def clonebundles(repo, proto):'
314 Otherwise, older clients would retrieve and error out on those.
331 Otherwise, older clients would retrieve and error out on those.
315 """
332 """
316 manifest_contents = bundlecaches.get_manifest(repo)
333 manifest_contents = bundlecaches.get_manifest(repo)
317 clientcapabilities = proto.getprotocaps()
334 return wireprototypes.bytesresponse(manifest_contents)
318 if b'inlineclonebundles' in clientcapabilities:
319 return wireprototypes.bytesresponse(manifest_contents)
320 modified_manifest = []
321 for line in manifest_contents.splitlines():
322 if line.startswith(bundlecaches.CLONEBUNDLESCHEME):
323 continue
324 modified_manifest.append(line)
325 return wireprototypes.bytesresponse(b'\n'.join(modified_manifest))
326
335
327
336
328 wireprotocaps = [
337 wireprotocaps = [
@@ -258,17 +258,16 b' Feature works over SSH with inline bundl'
258 HTTP Supports
258 HTTP Supports
259 -------------
259 -------------
260
260
261 Or lack of it actually
262
263 Feature does not use inline bundle over HTTP(S) because there is no protocaps support
264 (so no way for the client to announce that it supports inline clonebundles)
265 $ hg clone -U http://localhost:$HGPORT http-inline-clone
261 $ hg clone -U http://localhost:$HGPORT http-inline-clone
266 requesting all changes
262 applying clone bundle from peer-bundle-cache://full.hg
267 adding changesets
263 adding changesets
268 adding manifests
264 adding manifests
269 adding file changes
265 adding file changes
270 added 2 changesets with 2 changes to 2 files
266 added 2 changesets with 2 changes to 2 files
271 new changesets 53245c60e682:aaff8d2ffbbf
267 finished applying clone bundle
268 searching for changes
269 no changes found
270 2 local changesets published
272
271
273 Pre-transmit Hook
272 Pre-transmit Hook
274 -----------------
273 -----------------
@@ -657,7 +656,7 b' on a 32MB system.'
657 $ hg clone -U --debug --config ui.available-memory=16MB http://localhost:$HGPORT gzip-too-large
656 $ hg clone -U --debug --config ui.available-memory=16MB http://localhost:$HGPORT gzip-too-large
658 using http://localhost:$HGPORT/
657 using http://localhost:$HGPORT/
659 sending capabilities command
658 sending capabilities command
660 sending clonebundles command
659 sending clonebundles_manifest command
661 filtering http://localhost:$HGPORT1/gz-a.hg as it needs more than 2/3 of system memory
660 filtering http://localhost:$HGPORT1/gz-a.hg as it needs more than 2/3 of system memory
662 no compatible clone bundles available on server; falling back to regular clone
661 no compatible clone bundles available on server; falling back to regular clone
663 (you may want to report this to the server operator)
662 (you may want to report this to the server operator)
@@ -690,7 +689,7 b' on a 32MB system.'
690 $ hg clone -U --debug --config ui.available-memory=32MB http://localhost:$HGPORT gzip-too-large2
689 $ hg clone -U --debug --config ui.available-memory=32MB http://localhost:$HGPORT gzip-too-large2
691 using http://localhost:$HGPORT/
690 using http://localhost:$HGPORT/
692 sending capabilities command
691 sending capabilities command
693 sending clonebundles command
692 sending clonebundles_manifest command
694 applying clone bundle from http://localhost:$HGPORT1/gz-a.hg
693 applying clone bundle from http://localhost:$HGPORT1/gz-a.hg
695 bundle2-input-bundle: 1 params with-transaction
694 bundle2-input-bundle: 1 params with-transaction
696 bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported
695 bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported
@@ -90,7 +90,7 b' Test that we can apply the bundle as a s'
90 $ hg clone http://localhost:$HGPORT stream-clone-implicit --debug
90 $ hg clone http://localhost:$HGPORT stream-clone-implicit --debug
91 using http://localhost:$HGPORT/
91 using http://localhost:$HGPORT/
92 sending capabilities command
92 sending capabilities command
93 sending clonebundles command
93 sending clonebundles_manifest command
94 applying clone bundle from http://localhost:$HGPORT1/bundle.hg
94 applying clone bundle from http://localhost:$HGPORT1/bundle.hg
95 bundle2-input-bundle: with-transaction
95 bundle2-input-bundle: with-transaction
96 bundle2-input-part: "stream2" (params: 3 mandatory) supported (stream-v2 !)
96 bundle2-input-part: "stream2" (params: 3 mandatory) supported (stream-v2 !)
@@ -148,7 +148,7 b' Test that we can apply the bundle as a s'
148 $ hg clone --stream http://localhost:$HGPORT stream-clone-explicit --debug
148 $ hg clone --stream http://localhost:$HGPORT stream-clone-explicit --debug
149 using http://localhost:$HGPORT/
149 using http://localhost:$HGPORT/
150 sending capabilities command
150 sending capabilities command
151 sending clonebundles command
151 sending clonebundles_manifest command
152 applying clone bundle from http://localhost:$HGPORT1/bundle.hg
152 applying clone bundle from http://localhost:$HGPORT1/bundle.hg
153 bundle2-input-bundle: with-transaction
153 bundle2-input-bundle: with-transaction
154 bundle2-input-part: "stream2" (params: 3 mandatory) supported (stream-v2 !)
154 bundle2-input-part: "stream2" (params: 3 mandatory) supported (stream-v2 !)
General Comments 0
You need to be logged in to leave comments. Login now