diff -r c814101560d9 -r 60f9602b413e mercurial/exchange.py --- a/mercurial/exchange.py Wed May 31 18:08:56 2023 +0100 +++ b/mercurial/exchange.py Wed Mar 08 14:23:43 2023 +0100 @@ -2834,7 +2834,7 @@ url = entries[0][b'URL'] repo.ui.status(_(b'applying clone bundle from %s\n') % url) - if trypullbundlefromurl(repo.ui, repo, url): + if trypullbundlefromurl(repo.ui, repo, url, remote): repo.ui.status(_(b'finished applying clone bundle\n')) # Bundle failed. # @@ -2855,11 +2855,22 @@ ) -def trypullbundlefromurl(ui, repo, url): +def inline_clone_bundle_open(ui, url, peer): + if not peer: + raise error.Abort(_(b'no remote repository supplied for %s' % url)) + clonebundleid = url[len(bundlecaches.CLONEBUNDLESCHEME) :] + peerclonebundle = peer.get_inline_clone_bundle(clonebundleid) + return util.chunkbuffer(peerclonebundle) + + +def trypullbundlefromurl(ui, repo, url, peer): """Attempt to apply a bundle from a URL.""" with repo.lock(), repo.transaction(b'bundleurl') as tr: try: - fh = urlmod.open(ui, url) + if url.startswith(bundlecaches.CLONEBUNDLESCHEME): + fh = inline_clone_bundle_open(ui, url, peer) + else: + fh = urlmod.open(ui, url) cg = readbundle(ui, fh, b'stream') if isinstance(cg, streamclone.streamcloneapplier):