Mercurial > hg
changeset 51107:c2d2e5b65def
revlog: minor refactor in the chunk gather process
We will introduce some caching in this method in the next changeset, we make
some of the most "disruptive" change first as touching this could break (and
maybe did during the development process).
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 27 Oct 2023 02:57:09 +0200 |
parents | d83d788590a8 |
children | 0250e45040f1 |
files | mercurial/revlog.py |
diffstat | 1 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlog.py Tue Oct 24 11:08:49 2023 +0200 +++ b/mercurial/revlog.py Fri Oct 27 02:57:09 2023 +0200 @@ -901,6 +901,8 @@ l = [] ladd = l.append + chunks = [] + ladd = chunks.append if not self.data_config.with_sparse_read: slicedchunks = (revs,) @@ -923,7 +925,8 @@ except OverflowError: # issue4215 - we can't cache a run of chunks greater than # 2G on Windows - return [self._chunk(rev) for rev in revschunk] + for rev in revschunk: + ladd((rev, self._chunk(rev))) decomp = self.decompress # self._decompressor might be None, but will not be used in that case @@ -936,17 +939,18 @@ comp_mode = self.index[rev][10] c = buffer(data, chunkstart - offset, chunklength) if comp_mode == COMP_MODE_PLAIN: - ladd(c) + c = c elif comp_mode == COMP_MODE_INLINE: - ladd(decomp(c)) + c = decomp(c) elif comp_mode == COMP_MODE_DEFAULT: - ladd(def_decomp(c)) + c = def_decomp(c) else: msg = b'unknown compression mode %d' msg %= comp_mode raise error.RevlogError(msg) - - return l + ladd((rev, c)) + + return [x[1] for x in chunks] def raw_text(self, node, rev): """return the possibly unvalidated rawtext for a revision