Mercurial > hg
changeset 32227:1395f843ece4
revlog: rename internal functions containing "chunk" to use "segment"
Currently, "chunk" is overloaded in revlog terminology to mean
multiple things. One of them refers to a segment of raw data from
the revlog. This commit renames various methods only used within
revlog.py to have "segment" in their name instead of "chunk."
While I was here, I also made the names more descriptive. e.g.
"_loadchunk()" becomes "_readsegment()" because it actually does
I/O.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 06 May 2017 12:02:12 -0700 |
parents | bf3af0eced44 |
children | 112ba1c7d65d |
files | mercurial/revlog.py |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlog.py Sat May 06 16:36:24 2017 -0700 +++ b/mercurial/revlog.py Sat May 06 12:02:12 2017 -0700 @@ -1075,7 +1075,7 @@ p1, p2 = self.parents(node) return hash(text, p1, p2) != node - def _addchunk(self, offset, data): + def _cachesegment(self, offset, data): """Add a segment to the revlog cache. Accepts an absolute offset and the data that is at that location. @@ -1087,7 +1087,7 @@ else: self._chunkcache = offset, data - def _loadchunk(self, offset, length, df=None): + def _readsegment(self, offset, length, df=None): """Load a segment of raw data from the revlog. Accepts an absolute offset, length to read, and an optional existing @@ -1118,12 +1118,12 @@ d = df.read(reallength) if closehandle: df.close() - self._addchunk(realoffset, d) + self._cachesegment(realoffset, d) if offset != realoffset or reallength != length: return util.buffer(d, offset - realoffset, length) return d - def _getchunk(self, offset, length, df=None): + def _getsegment(self, offset, length, df=None): """Obtain a segment of raw data from the revlog. Accepts an absolute offset, length of bytes to obtain, and an @@ -1145,7 +1145,7 @@ return d # avoid a copy return util.buffer(d, cachestart, cacheend - cachestart) - return self._loadchunk(offset, length, df=df) + return self._readsegment(offset, length, df=df) def _chunkraw(self, startrev, endrev, df=None): """Obtain a segment of raw data corresponding to a range of revisions. @@ -1179,7 +1179,7 @@ end += (endrev + 1) * self._io.size length = end - start - return start, self._getchunk(start, length, df=df) + return start, self._getsegment(start, length, df=df) def _chunk(self, rev, df=None): """Obtain a single decompressed chunk for a revision.