Mercurial > public > mercurial-scm > hg
comparison mercurial/streamclone.py @ 26445:f134fb33c906
streamclone: move streaming clone logic from localrepo
This is the last remnants of streaming clone code in localrepo.py.
This is a mostly mechanical transplant of code to a new file. Only a
rewrite of "self" to "repo" was performed. The code will be
significantly refactored in upcoming patches. So don't scrutinize it too
closely.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 02 Oct 2015 21:39:04 -0700 |
parents | 623743010133 |
children | 3ea10bb761ce |
comparison
equal
deleted
inserted
replaced
26444:623743010133 | 26445:f134fb33c906 |
---|---|
14 branchmap, | 14 branchmap, |
15 error, | 15 error, |
16 store, | 16 store, |
17 util, | 17 util, |
18 ) | 18 ) |
19 | |
20 def maybeperformstreamclone(repo, remote, heads, stream): | |
21 # now, all clients that can request uncompressed clones can | |
22 # read repo formats supported by all servers that can serve | |
23 # them. | |
24 | |
25 # if revlog format changes, client will have to check version | |
26 # and format flags on "stream" capability, and use | |
27 # uncompressed only if compatible. | |
28 | |
29 if stream is None: | |
30 # if the server explicitly prefers to stream (for fast LANs) | |
31 stream = remote.capable('stream-preferred') | |
32 | |
33 if stream and not heads: | |
34 # 'stream' means remote revlog format is revlogv1 only | |
35 if remote.capable('stream'): | |
36 streamin(repo, remote, set(('revlogv1',))) | |
37 else: | |
38 # otherwise, 'streamreqs' contains the remote revlog format | |
39 streamreqs = remote.capable('streamreqs') | |
40 if streamreqs: | |
41 streamreqs = set(streamreqs.split(',')) | |
42 # if we support it, stream in and adjust our requirements | |
43 if not streamreqs - repo.supportedformats: | |
44 streamin(repo, remote, streamreqs) | |
19 | 45 |
20 def allowservergeneration(ui): | 46 def allowservergeneration(ui): |
21 """Whether streaming clones are allowed from the server.""" | 47 """Whether streaming clones are allowed from the server.""" |
22 return ui.configbool('server', 'uncompressed', True, untrusted=True) | 48 return ui.configbool('server', 'uncompressed', True, untrusted=True) |
23 | 49 |