Mercurial > hg
comparison mercurial/streamclone.py @ 50666:60f9602b413e
clonebundles: add support for inline (streaming) clonebundles
The idea behind inline clonebundles is to send them through
the ssh or https connection to the Mercurial server.
We've been using this specifically for streaming clonebundles,
although it works for 'regular' clonebundles as well
(but is less relevant, since pullbundles exist).
We've had this enabled for around 9 months for a part
of our users.
A few benefits are:
- no need to secure an external system,
since everything goes through the same Mercurial server
- easier scaling (in our case: no risk of inconsistencies
between multiple mercurial-server mirrors and nginx clonebundles hosts)
Remaining topics/questions right now:
- The inline clonebundles don't work for https yet.
This is because httppeer doesn't seem to support sending client
capabilities.
I didn't focus on that as my main goal was to get this working
for ssh.
author | Mathias De Mare <mathias.de_mare@nokia.com> |
---|---|
date | Wed, 08 Mar 2023 14:23:43 +0100 |
parents | 9caa860dcbec |
children | 0452af304808 |
comparison
equal
deleted
inserted
replaced
50646:c814101560d9 | 50666:60f9602b413e |
---|---|
426 | 426 |
427 with repo.transaction(b'clone'): | 427 with repo.transaction(b'clone'): |
428 with repo.svfs.backgroundclosing(repo.ui, expectedcount=filecount): | 428 with repo.svfs.backgroundclosing(repo.ui, expectedcount=filecount): |
429 for i in range(filecount): | 429 for i in range(filecount): |
430 # XXX doesn't support '\n' or '\r' in filenames | 430 # XXX doesn't support '\n' or '\r' in filenames |
431 l = fp.readline() | 431 if util.safehasattr(fp, 'readline'): |
432 l = fp.readline() | |
433 else: | |
434 # inline clonebundles use a chunkbuffer, so no readline | |
435 # --> this should be small anyway, the first line | |
436 # only contains the size of the bundle | |
437 l_buf = [] | |
438 while not (l_buf and l_buf[-1] == b'\n'): | |
439 l_buf.append(fp.read(1)) | |
440 l = b''.join(l_buf) | |
432 try: | 441 try: |
433 name, size = l.split(b'\0', 1) | 442 name, size = l.split(b'\0', 1) |
434 size = int(size) | 443 size = int(size) |
435 except (ValueError, TypeError): | 444 except (ValueError, TypeError): |
436 raise error.ResponseError( | 445 raise error.ResponseError( |