Show More
@@ -1788,30 +1788,6 b' class localrepository(object):' | |||||
1788 | """ |
|
1788 | """ | |
1789 | return util.hooks() |
|
1789 | return util.hooks() | |
1790 |
|
1790 | |||
1791 | def stream_in(self, remote, remotereqs): |
|
|||
1792 | # Save remote branchmap. We will use it later |
|
|||
1793 | # to speed up branchcache creation |
|
|||
1794 | rbranchmap = None |
|
|||
1795 | if remote.capable("branchmap"): |
|
|||
1796 | rbranchmap = remote.branchmap() |
|
|||
1797 |
|
||||
1798 | fp = remote.stream_out() |
|
|||
1799 | l = fp.readline() |
|
|||
1800 | try: |
|
|||
1801 | resp = int(l) |
|
|||
1802 | except ValueError: |
|
|||
1803 | raise error.ResponseError( |
|
|||
1804 | _('unexpected response from remote server:'), l) |
|
|||
1805 | if resp == 1: |
|
|||
1806 | raise util.Abort(_('operation forbidden by server')) |
|
|||
1807 | elif resp == 2: |
|
|||
1808 | raise util.Abort(_('locking the remote repository failed')) |
|
|||
1809 | elif resp != 0: |
|
|||
1810 | raise util.Abort(_('the server sent an unknown error code')) |
|
|||
1811 |
|
||||
1812 | streamclone.applyremotedata(self, remotereqs, rbranchmap, fp) |
|
|||
1813 | return len(self.heads()) + 1 |
|
|||
1814 |
|
||||
1815 | def clone(self, remote, heads=[], stream=None): |
|
1791 | def clone(self, remote, heads=[], stream=None): | |
1816 | '''clone remote repository. |
|
1792 | '''clone remote repository. | |
1817 |
|
1793 | |||
@@ -1834,7 +1810,7 b' class localrepository(object):' | |||||
1834 | if stream and not heads: |
|
1810 | if stream and not heads: | |
1835 | # 'stream' means remote revlog format is revlogv1 only |
|
1811 | # 'stream' means remote revlog format is revlogv1 only | |
1836 | if remote.capable('stream'): |
|
1812 | if remote.capable('stream'): | |
1837 |
self |
|
1813 | streamclone.streamin(self, remote, set(('revlogv1',))) | |
1838 | else: |
|
1814 | else: | |
1839 | # otherwise, 'streamreqs' contains the remote revlog format |
|
1815 | # otherwise, 'streamreqs' contains the remote revlog format | |
1840 | streamreqs = remote.capable('streamreqs') |
|
1816 | streamreqs = remote.capable('streamreqs') | |
@@ -1842,7 +1818,7 b' class localrepository(object):' | |||||
1842 | streamreqs = set(streamreqs.split(',')) |
|
1818 | streamreqs = set(streamreqs.split(',')) | |
1843 | # if we support it, stream in and adjust our requirements |
|
1819 | # if we support it, stream in and adjust our requirements | |
1844 | if not streamreqs - self.supportedformats: |
|
1820 | if not streamreqs - self.supportedformats: | |
1845 |
self |
|
1821 | streamclone.streamin(self, remote, streamreqs) | |
1846 |
|
1822 | |||
1847 | # internal config: ui.quietbookmarkmove |
|
1823 | # internal config: ui.quietbookmarkmove | |
1848 | quiet = self.ui.backupconfig('ui', 'quietbookmarkmove') |
|
1824 | quiet = self.ui.backupconfig('ui', 'quietbookmarkmove') |
@@ -7,11 +7,38 b'' | |||||
7 |
|
7 | |||
8 | from __future__ import absolute_import |
|
8 | from __future__ import absolute_import | |
9 |
|
9 | |||
|
10 | from .i18n import _ | |||
10 | from . import ( |
|
11 | from . import ( | |
11 | branchmap, |
|
12 | branchmap, | |
|
13 | error, | |||
12 | exchange, |
|
14 | exchange, | |
|
15 | util, | |||
13 | ) |
|
16 | ) | |
14 |
|
17 | |||
|
18 | def streamin(repo, remote, remotereqs): | |||
|
19 | # Save remote branchmap. We will use it later | |||
|
20 | # to speed up branchcache creation | |||
|
21 | rbranchmap = None | |||
|
22 | if remote.capable("branchmap"): | |||
|
23 | rbranchmap = remote.branchmap() | |||
|
24 | ||||
|
25 | fp = remote.stream_out() | |||
|
26 | l = fp.readline() | |||
|
27 | try: | |||
|
28 | resp = int(l) | |||
|
29 | except ValueError: | |||
|
30 | raise error.ResponseError( | |||
|
31 | _('unexpected response from remote server:'), l) | |||
|
32 | if resp == 1: | |||
|
33 | raise util.Abort(_('operation forbidden by server')) | |||
|
34 | elif resp == 2: | |||
|
35 | raise util.Abort(_('locking the remote repository failed')) | |||
|
36 | elif resp != 0: | |||
|
37 | raise util.Abort(_('the server sent an unknown error code')) | |||
|
38 | ||||
|
39 | applyremotedata(repo, remotereqs, rbranchmap, fp) | |||
|
40 | return len(repo.heads()) + 1 | |||
|
41 | ||||
15 | def applyremotedata(repo, remotereqs, remotebranchmap, fp): |
|
42 | def applyremotedata(repo, remotereqs, remotebranchmap, fp): | |
16 | """Apply stream clone data to a repository. |
|
43 | """Apply stream clone data to a repository. | |
17 |
|
44 |
General Comments 0
You need to be logged in to leave comments.
Login now