##// END OF EJS Templates
sparse-read: ignore trailing empty revs in each read chunk...
Paul Morelle -
r34899:1bde8e8e default
parent child Browse files
Show More
@@ -162,6 +162,20 b' def hash(text, p1, p2):'
162 s.update(text)
162 s.update(text)
163 return s.digest()
163 return s.digest()
164
164
165 def _trimchunk(revlog, revs, startidx, endidx=None):
166 """returns revs[startidx:endidx] without empty trailing revs
167 """
168 length = revlog.length
169
170 if endidx is None:
171 endidx = len(revs)
172
173 # Trim empty revs at the end, but never the very first revision of a chain
174 while endidx > 1 and endidx > startidx and length(revs[endidx - 1]) == 0:
175 endidx -= 1
176
177 return revs[startidx:endidx]
178
165 def _slicechunk(revlog, revs):
179 def _slicechunk(revlog, revs):
166 """slice revs to reduce the amount of unrelated data to be read from disk.
180 """slice revs to reduce the amount of unrelated data to be read from disk.
167
181
@@ -194,6 +208,10 b' def _slicechunk(revlog, revs):'
194 revstart = start(rev)
208 revstart = start(rev)
195 revlen = length(rev)
209 revlen = length(rev)
196
210
211 # Skip empty revisions to form larger holes
212 if revlen == 0:
213 continue
214
197 if prevend is not None:
215 if prevend is not None:
198 gapsize = revstart - prevend
216 gapsize = revstart - prevend
199 # only consider holes that are large enough
217 # only consider holes that are large enough
@@ -222,9 +240,16 b' def _slicechunk(revlog, revs):'
222 previdx = 0
240 previdx = 0
223 while indicesheap:
241 while indicesheap:
224 idx = heapq.heappop(indicesheap)
242 idx = heapq.heappop(indicesheap)
225 yield revs[previdx:idx]
243
244 chunk = _trimchunk(revlog, revs, previdx, idx)
245 if chunk:
246 yield chunk
247
226 previdx = idx
248 previdx = idx
227 yield revs[previdx:]
249
250 chunk = _trimchunk(revlog, revs, previdx)
251 if chunk:
252 yield chunk
228
253
229 # index v0:
254 # index v0:
230 # 4 bytes: offset
255 # 4 bytes: offset
General Comments 0
You need to be logged in to leave comments. Login now