Show More
@@ -77,7 +77,27 b' def maybeperformstreamclone(pullop):' | |||||
77 | if not supported: |
|
77 | if not supported: | |
78 | return |
|
78 | return | |
79 |
|
79 | |||
80 | streamin(repo, remote, requirements) |
|
80 | # Save remote branchmap. We will use it later to speed up branchcache | |
|
81 | # creation. | |||
|
82 | rbranchmap = None | |||
|
83 | if remote.capable('branchmap'): | |||
|
84 | rbranchmap = remote.branchmap() | |||
|
85 | ||||
|
86 | fp = remote.stream_out() | |||
|
87 | l = fp.readline() | |||
|
88 | try: | |||
|
89 | resp = int(l) | |||
|
90 | except ValueError: | |||
|
91 | raise error.ResponseError( | |||
|
92 | _('unexpected response from remote server:'), l) | |||
|
93 | if resp == 1: | |||
|
94 | raise util.Abort(_('operation forbidden by server')) | |||
|
95 | elif resp == 2: | |||
|
96 | raise util.Abort(_('locking the remote repository failed')) | |||
|
97 | elif resp != 0: | |||
|
98 | raise util.Abort(_('the server sent an unknown error code')) | |||
|
99 | ||||
|
100 | applyremotedata(repo, requirements, rbranchmap, fp) | |||
81 |
|
101 | |||
82 | def allowservergeneration(ui): |
|
102 | def allowservergeneration(ui): | |
83 | """Whether streaming clones are allowed from the server.""" |
|
103 | """Whether streaming clones are allowed from the server.""" | |
@@ -211,30 +231,6 b' def consumev1(repo, fp):' | |||||
211 | finally: |
|
231 | finally: | |
212 | lock.release() |
|
232 | lock.release() | |
213 |
|
233 | |||
214 | def streamin(repo, remote, remotereqs): |
|
|||
215 | # Save remote branchmap. We will use it later |
|
|||
216 | # to speed up branchcache creation |
|
|||
217 | rbranchmap = None |
|
|||
218 | if remote.capable("branchmap"): |
|
|||
219 | rbranchmap = remote.branchmap() |
|
|||
220 |
|
||||
221 | fp = remote.stream_out() |
|
|||
222 | l = fp.readline() |
|
|||
223 | try: |
|
|||
224 | resp = int(l) |
|
|||
225 | except ValueError: |
|
|||
226 | raise error.ResponseError( |
|
|||
227 | _('unexpected response from remote server:'), l) |
|
|||
228 | if resp == 1: |
|
|||
229 | raise util.Abort(_('operation forbidden by server')) |
|
|||
230 | elif resp == 2: |
|
|||
231 | raise util.Abort(_('locking the remote repository failed')) |
|
|||
232 | elif resp != 0: |
|
|||
233 | raise util.Abort(_('the server sent an unknown error code')) |
|
|||
234 |
|
||||
235 | applyremotedata(repo, remotereqs, rbranchmap, fp) |
|
|||
236 | return len(repo.heads()) + 1 |
|
|||
237 |
|
||||
238 | def applyremotedata(repo, remotereqs, remotebranchmap, fp): |
|
234 | def applyremotedata(repo, remotereqs, remotebranchmap, fp): | |
239 | """Apply stream clone data to a repository. |
|
235 | """Apply stream clone data to a repository. | |
240 |
|
236 |
General Comments 0
You need to be logged in to leave comments.
Login now