equal
deleted
inserted
replaced
22 raise util.Abort(_("premature EOF reading chunk" |
22 raise util.Abort(_("premature EOF reading chunk" |
23 " (got %d bytes, expected %d)") |
23 " (got %d bytes, expected %d)") |
24 % (len(d), l - 4)) |
24 % (len(d), l - 4)) |
25 return d |
25 return d |
26 |
26 |
27 def chunkiter(source): |
27 def chunkiter(source, progress=None): |
28 """iterate through the chunks in source, yielding a sequence of chunks |
28 """iterate through the chunks in source, yielding a sequence of chunks |
29 (strings)""" |
29 (strings)""" |
30 while 1: |
30 while 1: |
31 c = getchunk(source) |
31 c = getchunk(source) |
32 if not c: |
32 if not c: |
33 break |
33 break |
|
34 elif progress is not None: |
|
35 progress() |
34 yield c |
36 yield c |
35 |
37 |
36 def chunkheader(length): |
38 def chunkheader(length): |
37 """return a changegroup chunk header (string)""" |
39 """return a changegroup chunk header (string)""" |
38 return struct.pack(">l", length + 4) |
40 return struct.pack(">l", length + 4) |