Show More
@@ -97,7 +97,24 b' def maybeperformstreamclone(pullop):' | |||||
97 | elif resp != 0: |
|
97 | elif resp != 0: | |
98 | raise util.Abort(_('the server sent an unknown error code')) |
|
98 | raise util.Abort(_('the server sent an unknown error code')) | |
99 |
|
99 | |||
100 | applyremotedata(repo, requirements, rbranchmap, fp) |
|
100 | lock = repo.lock() | |
|
101 | try: | |||
|
102 | consumev1(repo, fp) | |||
|
103 | ||||
|
104 | # new requirements = old non-format requirements + | |||
|
105 | # new format-related remote requirements | |||
|
106 | # requirements from the streamed-in repository | |||
|
107 | repo.requirements = requirements | ( | |||
|
108 | repo.requirements - repo.supportedformats) | |||
|
109 | repo._applyopenerreqs() | |||
|
110 | repo._writerequirements() | |||
|
111 | ||||
|
112 | if rbranchmap: | |||
|
113 | branchmap.replacecache(repo, rbranchmap) | |||
|
114 | ||||
|
115 | repo.invalidate() | |||
|
116 | finally: | |||
|
117 | lock.release() | |||
101 |
|
118 | |||
102 | def allowservergeneration(ui): |
|
119 | def allowservergeneration(ui): | |
103 | """Whether streaming clones are allowed from the server.""" |
|
120 | """Whether streaming clones are allowed from the server.""" | |
@@ -230,31 +247,3 b' def consumev1(repo, fp):' | |||||
230 | util.bytecount(total_bytes / elapsed))) |
|
247 | util.bytecount(total_bytes / elapsed))) | |
231 | finally: |
|
248 | finally: | |
232 | lock.release() |
|
249 | lock.release() | |
233 |
|
||||
234 | def applyremotedata(repo, remotereqs, remotebranchmap, fp): |
|
|||
235 | """Apply stream clone data to a repository. |
|
|||
236 |
|
||||
237 | "remotereqs" is a set of requirements to handle the incoming data. |
|
|||
238 | "remotebranchmap" is the result of a branchmap lookup on the remote. It |
|
|||
239 | can be None. |
|
|||
240 | "fp" is a file object containing the raw stream data, suitable for |
|
|||
241 | feeding into consumev1(). |
|
|||
242 | """ |
|
|||
243 | lock = repo.lock() |
|
|||
244 | try: |
|
|||
245 | consumev1(repo, fp) |
|
|||
246 |
|
||||
247 | # new requirements = old non-format requirements + |
|
|||
248 | # new format-related remote requirements |
|
|||
249 | # requirements from the streamed-in repository |
|
|||
250 | repo.requirements = remotereqs | ( |
|
|||
251 | repo.requirements - repo.supportedformats) |
|
|||
252 | repo._applyopenerreqs() |
|
|||
253 | repo._writerequirements() |
|
|||
254 |
|
||||
255 | if remotebranchmap: |
|
|||
256 | branchmap.replacecache(repo, remotebranchmap) |
|
|||
257 |
|
||||
258 | repo.invalidate() |
|
|||
259 | finally: |
|
|||
260 | lock.release() |
|
General Comments 0
You need to be logged in to leave comments.
Login now