Show More
@@ -235,10 +235,26 b' def generatev1(repo):' | |||||
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 |
|
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 | byte size of payload. | |||
|
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). | |||
240 | """ |
|
245 | """ | |
241 | filecount, bytecount, it = generatev1(repo) |
|
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 |
@@ -954,21 +954,7 b' def stream(repo, proto):' | |||||
954 | capability with a value representing the version and flags of the repo |
|
954 | capability with a value representing the version and flags of the repo | |
955 | it is serving. Client checks to see if it understands the format. |
|
955 | it is serving. Client checks to see if it understands the format. | |
956 | ''' |
|
956 | ''' | |
957 |
|
|
957 | return streamres(streamclone.generatev1wireproto(repo)) | |
958 | return '1\n' |
|
|||
959 |
|
||||
960 | def getstream(it): |
|
|||
961 | yield '0\n' |
|
|||
962 | for chunk in it: |
|
|||
963 | yield chunk |
|
|||
964 |
|
||||
965 | try: |
|
|||
966 | # LockError may be raised before the first result is yielded. Don't |
|
|||
967 | # emit output until we're sure we got the lock successfully. |
|
|||
968 | it = streamclone.generatev1wireproto(repo) |
|
|||
969 | return streamres(gen=getstream(it)) |
|
|||
970 | except error.LockError: |
|
|||
971 | return '2\n' |
|
|||
972 |
|
958 | |||
973 | @wireprotocommand('unbundle', 'heads') |
|
959 | @wireprotocommand('unbundle', 'heads') | |
974 | def unbundle(repo, proto, heads): |
|
960 | def unbundle(repo, proto, heads): |
General Comments 0
You need to be logged in to leave comments.
Login now