Show More
@@ -920,7 +920,7 b' class revlog(object):' | |||
|
920 | 920 | # Derived from index values. |
|
921 | 921 | |
|
922 | 922 | def end(self, rev): |
|
923 |
return self.start(rev) + self.length(rev) |
|
|
923 | return self.start(rev) + self.length(rev) | |
|
924 | 924 | |
|
925 | 925 | def parents(self, node): |
|
926 | 926 | i = self.index |
@@ -2331,7 +2331,8 b' class revlog(object):' | |||
|
2331 | 2331 | |
|
2332 | 2332 | curr = len(self) |
|
2333 | 2333 | prev = curr - 1 |
|
2334 | offset = self.end(prev) | |
|
2334 | ||
|
2335 | offset = self._get_data_offset(prev) | |
|
2335 | 2336 | |
|
2336 | 2337 | if self._concurrencychecker: |
|
2337 | 2338 | if self._inline: |
@@ -2417,6 +2418,26 b' class revlog(object):' | |||
|
2417 | 2418 | self._chainbasecache[curr] = deltainfo.chainbase |
|
2418 | 2419 | return curr |
|
2419 | 2420 | |
|
2421 | def _get_data_offset(self, prev): | |
|
2422 | """Returns the current offset in the (in-transaction) data file. | |
|
2423 | Versions < 2 of the revlog can get this 0(1), revlog v2 needs a docket | |
|
2424 | file to store that information: since sidedata can be rewritten to the | |
|
2425 | end of the data file within a transaction, you can have cases where, for | |
|
2426 | example, rev `n` does not have sidedata while rev `n - 1` does, leading | |
|
2427 | to `n - 1`'s sidedata being written after `n`'s data. | |
|
2428 | ||
|
2429 | TODO cache this in a docket file before getting out of experimental.""" | |
|
2430 | if self.version & 0xFFFF != REVLOGV2: | |
|
2431 | return self.end(prev) | |
|
2432 | ||
|
2433 | offset = 0 | |
|
2434 | for rev, entry in enumerate(self.index): | |
|
2435 | sidedata_end = entry[8] + entry[9] | |
|
2436 | # Sidedata for a previous rev has potentially been written after | |
|
2437 | # this rev's end, so take the max. | |
|
2438 | offset = max(self.end(rev), offset, sidedata_end) | |
|
2439 | return offset | |
|
2440 | ||
|
2420 | 2441 | def _writeentry( |
|
2421 | 2442 | self, transaction, ifh, dfh, entry, data, link, offset, sidedata |
|
2422 | 2443 | ): |
General Comments 0
You need to be logged in to leave comments.
Login now