--- a/mercurial/streamclone.py Fri Oct 02 16:24:56 2015 -0700
+++ b/mercurial/streamclone.py Fri Oct 02 21:39:04 2015 -0700
@@ -17,6 +17,32 @@
util,
)
+def maybeperformstreamclone(repo, remote, heads, stream):
+ # now, all clients that can request uncompressed clones can
+ # read repo formats supported by all servers that can serve
+ # them.
+
+ # if revlog format changes, client will have to check version
+ # and format flags on "stream" capability, and use
+ # uncompressed only if compatible.
+
+ if stream is None:
+ # if the server explicitly prefers to stream (for fast LANs)
+ stream = remote.capable('stream-preferred')
+
+ if stream and not heads:
+ # 'stream' means remote revlog format is revlogv1 only
+ if remote.capable('stream'):
+ streamin(repo, remote, set(('revlogv1',)))
+ else:
+ # otherwise, 'streamreqs' contains the remote revlog format
+ streamreqs = remote.capable('streamreqs')
+ if streamreqs:
+ streamreqs = set(streamreqs.split(','))
+ # if we support it, stream in and adjust our requirements
+ if not streamreqs - repo.supportedformats:
+ streamin(repo, remote, streamreqs)
+
def allowservergeneration(ui):
"""Whether streaming clones are allowed from the server."""
return ui.configbool('server', 'uncompressed', True, untrusted=True)