comparison mercurial/localrepo.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 ef8d27f53204
children e05fd574c922
comparison
equal deleted inserted replaced
26444:623743010133 26445:f134fb33c906
1792 '''clone remote repository. 1792 '''clone remote repository.
1793 1793
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')
1825 try: 1801 try:
1826 self.ui.setconfig('ui', 'quietbookmarkmove', True, 'clone') 1802 self.ui.setconfig('ui', 'quietbookmarkmove', True, 'clone')