Show More
@@ -842,13 +842,17 b' class revlog(object):' | |||||
842 | else: |
|
842 | else: | |
843 | df = self.opener(self.datafile) |
|
843 | df = self.opener(self.datafile) | |
844 |
|
844 | |||
845 | readahead = max(65536, length) |
|
845 | # Cache data both forward and backward around the requested | |
846 | df.seek(offset) |
|
846 | # data, in a fixed size window. This helps speed up operations | |
847 | d = df.read(readahead) |
|
847 | # involving reading the revlog backwards. | |
|
848 | realoffset = offset & ~65535 | |||
|
849 | reallength = ((offset + length + 65536) & ~65535) - realoffset | |||
|
850 | df.seek(realoffset) | |||
|
851 | d = df.read(reallength) | |||
848 | df.close() |
|
852 | df.close() | |
849 | self._addchunk(offset, d) |
|
853 | self._addchunk(realoffset, d) | |
850 | if readahead > length: |
|
854 | if offset != realoffset or reallength != length: | |
851 |
return util.buffer(d, |
|
855 | return util.buffer(d, offset - realoffset, length) | |
852 | return d |
|
856 | return d | |
853 |
|
857 | |||
854 | def _getchunk(self, offset, length): |
|
858 | def _getchunk(self, offset, length): |
General Comments 0
You need to be logged in to leave comments.
Login now