Show More
@@ -164,13 +164,12 b' def _walkstreamfiles(repo):' | |||
|
164 | 164 | def generatev1(repo): |
|
165 | 165 | """Emit content for version 1 of a streaming clone. |
|
166 | 166 | |
|
167 | This is a generator of raw chunks that constitute a streaming clone. | |
|
167 | This returns a 3-tuple of (file count, byte size, data iterator). | |
|
168 | 168 | |
|
169 | The stream begins with a line of 2 space-delimited integers containing the | |
|
170 | number of entries and total bytes size. | |
|
169 | The data iterator consists of N entries for each file being transferred. | |
|
170 | Each file entry starts as a line with the file name and integer size | |
|
171 | delimited by a null byte. | |
|
171 | 172 | |
|
172 | Next, are N entries for each file being transferred. Each file entry starts | |
|
173 | as a line with the file name and integer size delimited by a null byte. | |
|
174 | 173 | The raw file data follows. Following the raw file data is the next file |
|
175 | 174 | entry, or EOF. |
|
176 | 175 | |
@@ -196,13 +195,13 b' def generatev1(repo):' | |||
|
196 | 195 | |
|
197 | 196 | repo.ui.debug('%d files, %d bytes to transfer\n' % |
|
198 | 197 | (len(entries), total_bytes)) |
|
199 | yield '%d %d\n' % (len(entries), total_bytes) | |
|
200 | 198 | |
|
201 | 199 | svfs = repo.svfs |
|
202 | 200 | oldaudit = svfs.mustaudit |
|
203 | 201 | debugflag = repo.ui.debugflag |
|
204 | 202 | svfs.mustaudit = False |
|
205 | 203 | |
|
204 | def emitrevlogdata(): | |
|
206 | 205 | try: |
|
207 | 206 | for name, size in entries: |
|
208 | 207 | if debugflag: |
@@ -222,6 +221,19 b' def generatev1(repo):' | |||
|
222 | 221 | finally: |
|
223 | 222 | svfs.mustaudit = oldaudit |
|
224 | 223 | |
|
224 | return len(entries), total_bytes, emitrevlogdata() | |
|
225 | ||
|
226 | def generatev1wireproto(repo): | |
|
227 | """Emit content for version 1 of streaming clone suitable for the wire. | |
|
228 | ||
|
229 | This is the data output from ``generatev1()`` with a header line | |
|
230 | indicating file count and byte size. | |
|
231 | """ | |
|
232 | filecount, bytecount, it = generatev1(repo) | |
|
233 | yield '%d %d\n' % (filecount, bytecount) | |
|
234 | for chunk in it: | |
|
235 | yield chunk | |
|
236 | ||
|
225 | 237 | def consumev1(repo, fp, filecount, bytecount): |
|
226 | 238 | """Apply the contents from version 1 of a streaming clone file handle. |
|
227 | 239 |
@@ -718,7 +718,7 b' def stream(repo, proto):' | |||
|
718 | 718 | try: |
|
719 | 719 | # LockError may be raised before the first result is yielded. Don't |
|
720 | 720 | # emit output until we're sure we got the lock successfully. |
|
721 | it = streamclone.generatev1(repo) | |
|
721 | it = streamclone.generatev1wireproto(repo) | |
|
722 | 722 | return streamres(getstream(it)) |
|
723 | 723 | except error.LockError: |
|
724 | 724 | return '2\n' |
General Comments 0
You need to be logged in to leave comments.
Login now