##// END OF EJS Templates
streamclone: move streaming clone logic from localrepo...
Gregory Szorc -
r26445:f134fb33 default
parent child Browse files
Show More
@@ -1794,31 +1794,7 b' class localrepository(object):'
1794 keyword arguments:
1794 keyword arguments:
1795 heads: list of revs to clone (forces use of pull)
1795 heads: list of revs to clone (forces use of pull)
1796 stream: use streaming clone if possible'''
1796 stream: use streaming clone if possible'''
1797
1797 streamclone.maybeperformstreamclone(self, remote, heads, stream)
1798 # now, all clients that can request uncompressed clones can
1799 # read repo formats supported by all servers that can serve
1800 # them.
1801
1802 # if revlog format changes, client will have to check version
1803 # and format flags on "stream" capability, and use
1804 # uncompressed only if compatible.
1805
1806 if stream is None:
1807 # if the server explicitly prefers to stream (for fast LANs)
1808 stream = remote.capable('stream-preferred')
1809
1810 if stream and not heads:
1811 # 'stream' means remote revlog format is revlogv1 only
1812 if remote.capable('stream'):
1813 streamclone.streamin(self, remote, set(('revlogv1',)))
1814 else:
1815 # otherwise, 'streamreqs' contains the remote revlog format
1816 streamreqs = remote.capable('streamreqs')
1817 if streamreqs:
1818 streamreqs = set(streamreqs.split(','))
1819 # if we support it, stream in and adjust our requirements
1820 if not streamreqs - self.supportedformats:
1821 streamclone.streamin(self, remote, streamreqs)
1822
1798
1823 # internal config: ui.quietbookmarkmove
1799 # internal config: ui.quietbookmarkmove
1824 quiet = self.ui.backupconfig('ui', 'quietbookmarkmove')
1800 quiet = self.ui.backupconfig('ui', 'quietbookmarkmove')
@@ -17,6 +17,32 b' from . import ('
17 util,
17 util,
18 )
18 )
19
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)
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)
General Comments 0
You need to be logged in to leave comments. Login now