##// END OF EJS Templates
chunkbuffer: split big strings directly in chunkbuffer
Benoit Boissinot -
r11670:1b3b843e default
parent child Browse files
Show More
@@ -1193,13 +1193,6 b' class revlog(object):'
1193 1193 d = self.revdiff(a, b)
1194 1194 yield changegroup.chunkheader(len(meta) + len(d))
1195 1195 yield meta
1196 if len(d) > 2**20:
1197 pos = 0
1198 while pos < len(d):
1199 pos2 = pos + 2 ** 18
1200 yield d[pos:pos2]
1201 pos = pos2
1202 else:
1203 1196 yield d
1204 1197
1205 1198 yield changegroup.closechunk()
@@ -914,7 +914,17 b' class chunkbuffer(object):'
914 914 def __init__(self, in_iter):
915 915 """in_iter is the iterator that's iterating over the input chunks.
916 916 targetsize is how big a buffer to try to maintain."""
917 self.iter = iter(in_iter)
917 def splitbig(chunks):
918 for chunk in chunks:
919 if len(chunk) > 2**20:
920 pos = 0
921 while pos < len(chunk):
922 end = pos + 2 ** 18
923 yield chunk[pos:end]
924 pos = end
925 else:
926 yield chunk
927 self.iter = splitbig(in_iter)
918 928 self.buf = ''
919 929
920 930 def read(self, l):
General Comments 0
You need to be logged in to leave comments. Login now