Show More
@@ -225,9 +225,8 class revlog(object): | |||
|
225 | 225 | self.opener = opener |
|
226 | 226 | # 3-tuple of (node, rev, text) for a raw revision. |
|
227 | 227 | self._cache = None |
|
228 | # 2-tuple of (rev, baserev) defining the base revision the delta chain | |
|
229 | # begins at for a revision. | |
|
230 | self._basecache = None | |
|
228 | # Maps rev to chain base rev. | |
|
229 | self._chainbasecache = util.lrucachedict(100) | |
|
231 | 230 | # 2-tuple of (offset, data) of raw data from the revlog at an offset. |
|
232 | 231 | self._chunkcache = (0, '') |
|
233 | 232 | # How much data to read and cache into the raw revlog data cache. |
@@ -340,7 +339,7 class revlog(object): | |||
|
340 | 339 | |
|
341 | 340 | def clearcaches(self): |
|
342 | 341 | self._cache = None |
|
343 |
self._basecache |
|
|
342 | self._chainbasecache.clear() | |
|
344 | 343 | self._chunkcache = (0, '') |
|
345 | 344 | self._pcache = {} |
|
346 | 345 | |
@@ -390,11 +389,17 class revlog(object): | |||
|
390 | 389 | def length(self, rev): |
|
391 | 390 | return self.index[rev][1] |
|
392 | 391 | def chainbase(self, rev): |
|
392 | base = self._chainbasecache.get(rev) | |
|
393 | if base is not None: | |
|
394 | return base | |
|
395 | ||
|
393 | 396 | index = self.index |
|
394 | 397 | base = index[rev][3] |
|
395 | 398 | while base != rev: |
|
396 | 399 | rev = base |
|
397 | 400 | base = index[rev][3] |
|
401 | ||
|
402 | self._chainbasecache[rev] = base | |
|
398 | 403 | return base |
|
399 | 404 | def chainlen(self, rev): |
|
400 | 405 | return self._chaininfo(rev)[0] |
@@ -1430,9 +1435,6 class revlog(object): | |||
|
1430 | 1435 | delta = mdiff.textdiff(ptext, t) |
|
1431 | 1436 | data = self.compress(delta) |
|
1432 | 1437 | l = len(data[1]) + len(data[0]) |
|
1433 | if basecache[0] == rev: | |
|
1434 | chainbase = basecache[1] | |
|
1435 | else: | |
|
1436 | 1438 |
|
|
1437 | 1439 | dist = l + offset - self.start(chainbase) |
|
1438 | 1440 | if self._generaldelta: |
@@ -1448,9 +1450,6 class revlog(object): | |||
|
1448 | 1450 | prev = curr - 1 |
|
1449 | 1451 | offset = self.end(prev) |
|
1450 | 1452 | delta = None |
|
1451 | if self._basecache is None: | |
|
1452 | self._basecache = (prev, self.chainbase(prev)) | |
|
1453 | basecache = self._basecache | |
|
1454 | 1453 | p1r, p2r = self.rev(p1), self.rev(p2) |
|
1455 | 1454 | |
|
1456 | 1455 | # full versions are inserted when the needed deltas |
@@ -1514,7 +1513,7 class revlog(object): | |||
|
1514 | 1513 | |
|
1515 | 1514 | if type(text) == str: # only accept immutable objects |
|
1516 | 1515 | self._cache = (node, curr, text) |
|
1517 |
self._basecache = |
|
|
1516 | self._chainbasecache[curr] = chainbase | |
|
1518 | 1517 | return node |
|
1519 | 1518 | |
|
1520 | 1519 | def _writeentry(self, transaction, ifh, dfh, entry, data, link, offset): |
General Comments 0
You need to be logged in to leave comments.
Login now