233 return len(entries), total_bytes, emitrevlogdata() |
233 return len(entries), total_bytes, emitrevlogdata() |
234 |
234 |
235 def generatev1wireproto(repo): |
235 def generatev1wireproto(repo): |
236 """Emit content for version 1 of streaming clone suitable for the wire. |
236 """Emit content for version 1 of streaming clone suitable for the wire. |
237 |
237 |
238 This is the data output from ``generatev1()`` with a header line |
238 This is the data output from ``generatev1()`` with 2 header lines. The |
239 indicating file count and byte size. |
239 first line indicates overall success. The 2nd contains the file count and |
240 """ |
240 byte size of payload. |
241 filecount, bytecount, it = generatev1(repo) |
241 |
|
242 The success line contains "0" for success, "1" for stream generation not |
|
243 allowed, and "2" for error locking the repository (possibly indicating |
|
244 a permissions error for the server process). |
|
245 """ |
|
246 if not allowservergeneration(repo): |
|
247 yield '1\n' |
|
248 return |
|
249 |
|
250 try: |
|
251 filecount, bytecount, it = generatev1(repo) |
|
252 except error.LockError: |
|
253 yield '2\n' |
|
254 return |
|
255 |
|
256 # Indicates successful response. |
|
257 yield '0\n' |
242 yield '%d %d\n' % (filecount, bytecount) |
258 yield '%d %d\n' % (filecount, bytecount) |
243 for chunk in it: |
259 for chunk in it: |
244 yield chunk |
260 yield chunk |
245 |
261 |
246 def generatebundlev1(repo, compression='UN'): |
262 def generatebundlev1(repo, compression='UN'): |