Show More
@@ -307,7 +307,6 b' def offset_type(offset, type):' | |||
|
307 | 307 | |
|
308 | 308 | class revlogoldio(object): |
|
309 | 309 | def __init__(self): |
|
310 | self.chunkcache = None | |
|
311 | 310 | self.size = struct.calcsize(indexformatv0) |
|
312 | 311 | |
|
313 | 312 | def parseindex(self, fp, st, inline): |
@@ -328,11 +327,10 b' class revlogoldio(object):' | |||
|
328 | 327 | nodemap[e[6]] = n |
|
329 | 328 | n += 1 |
|
330 | 329 | |
|
331 | return index, nodemap | |
|
330 | return index, nodemap, None | |
|
332 | 331 | |
|
333 | 332 | class revlogio(object): |
|
334 | 333 | def __init__(self): |
|
335 | self.chunkcache = None | |
|
336 | 334 | self.size = struct.calcsize(indexformatng) |
|
337 | 335 | |
|
338 | 336 | def parseindex(self, fp, st, inline): |
@@ -346,9 +344,10 b' class revlogio(object):' | |||
|
346 | 344 | type = gettype(e[0]) |
|
347 | 345 | e[0] = offset_type(0, type) |
|
348 | 346 | index[0] = e |
|
349 | return index, nodemap | |
|
347 | return index, nodemap, None | |
|
350 | 348 | |
|
351 | 349 | s = self.size |
|
350 | cache = None | |
|
352 | 351 | index = [] |
|
353 | 352 | nodemap = {nullid: nullrev} |
|
354 | 353 | n = off = 0 |
@@ -356,7 +355,7 b' class revlogio(object):' | |||
|
356 | 355 | data = fp.read() |
|
357 | 356 | l = len(data) |
|
358 | 357 | if inline: |
|
359 |
|
|
|
358 | cache = (0, data) | |
|
360 | 359 | while off + s <= l: |
|
361 | 360 | e = struct.unpack(indexformatng, data[off:off + s]) |
|
362 | 361 | index.append(e) |
@@ -373,7 +372,7 b' class revlogio(object):' | |||
|
373 | 372 | e[0] = offset_type(0, type) |
|
374 | 373 | index[0] = e |
|
375 | 374 | |
|
376 | return index, nodemap | |
|
375 | return index, nodemap, cache | |
|
377 | 376 | |
|
378 | 377 | class revlog(object): |
|
379 | 378 | """ |
@@ -413,6 +412,7 b' class revlog(object):' | |||
|
413 | 412 | |
|
414 | 413 | self.indexstat = None |
|
415 | 414 | self.cache = None |
|
415 | self._chunkcache = None | |
|
416 | 416 | self.defversion = REVLOG_DEFAULT_VERSION |
|
417 | 417 | if hasattr(opener, "defversion"): |
|
418 | 418 | self.defversion = opener.defversion |
@@ -467,7 +467,8 b' class revlog(object):' | |||
|
467 | 467 | if self.version == REVLOGV0: |
|
468 | 468 | self._io = revlogoldio() |
|
469 | 469 | if i: |
|
470 |
|
|
|
470 | d = self._io.parseindex(f, st, self._inline) | |
|
471 | self.index, self.nodemap, self._chunkcache = d | |
|
471 | 472 | # add the magic null revision at -1 |
|
472 | 473 | self.index.append((0, 0, 0, -1, -1, -1, -1, nullid)) |
|
473 | 474 | |
@@ -855,13 +856,13 b' class revlog(object):' | |||
|
855 | 856 | else: |
|
856 | 857 | df = self.opener(self.datafile) |
|
857 | 858 | df.seek(start) |
|
858 |
self._ |
|
|
859 | self._chunkcache = (start, df.read(cache_length)) | |
|
859 | 860 | |
|
860 |
if not self._ |
|
|
861 | if not self._chunkcache: | |
|
861 | 862 | loadcache(df) |
|
862 | 863 | |
|
863 |
cache_start = self._ |
|
|
864 |
cache_end = cache_start + len(self._ |
|
|
864 | cache_start = self._chunkcache[0] | |
|
865 | cache_end = cache_start + len(self._chunkcache[1]) | |
|
865 | 866 | if start >= cache_start and end <= cache_end: |
|
866 | 867 | # it is cached |
|
867 | 868 | offset = start - cache_start |
@@ -869,7 +870,7 b' class revlog(object):' | |||
|
869 | 870 | loadcache(df) |
|
870 | 871 | offset = 0 |
|
871 | 872 | |
|
872 |
return decompress(self._ |
|
|
873 | return decompress(self._chunkcache[1][offset:offset + length]) | |
|
873 | 874 | |
|
874 | 875 | def delta(self, node): |
|
875 | 876 | """return or calculate a delta between a node and its predecessor""" |
@@ -975,7 +976,7 b' class revlog(object):' | |||
|
975 | 976 | fp.rename() |
|
976 | 977 | |
|
977 | 978 | tr.replace(self.indexfile, trindex * calc) |
|
978 |
self._ |
|
|
979 | self._chunkcache = None | |
|
979 | 980 | |
|
980 | 981 | def addrevision(self, text, transaction, link, p1, p2, d=None): |
|
981 | 982 | """add a revision to the log |
@@ -1233,7 +1234,7 b' class revlog(object):' | |||
|
1233 | 1234 | |
|
1234 | 1235 | # then reset internal state in memory to forget those revisions |
|
1235 | 1236 | self.cache = None |
|
1236 |
self._ |
|
|
1237 | self._chunkcache = None | |
|
1237 | 1238 | for x in xrange(rev, self.count()): |
|
1238 | 1239 | del self.nodemap[self.node(x)] |
|
1239 | 1240 |
General Comments 0
You need to be logged in to leave comments.
Login now