Mercurial > hg-stable
changeset 46860:1dc86c2a43ce
revlog: directly use the Struct object for related operation
The Struct object has all the piece we needs, so no need to duplicate
information on the revlog itself.
Differential Revision: https://phab.mercurial-scm.org/D10307
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 05 Apr 2021 12:21:58 +0200 |
parents | c6e23fb4bfb4 |
children | c7c6c11fe1e4 |
files | mercurial/pure/parsers.py |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/pure/parsers.py Mon Apr 05 12:21:23 2021 +0200 +++ b/mercurial/pure/parsers.py Mon Apr 05 12:21:58 2021 +0200 @@ -44,7 +44,7 @@ class BaseIndexObject(object): # Format of an index entry according to Python's `struct` language - index_format = revlog_constants.INDEX_ENTRY_V1.format + index_format = revlog_constants.INDEX_ENTRY_V1 # Size of a C unsigned long long int, platform independent big_int_size = struct.calcsize(b'>Q') # Size of a C long int, platform independent @@ -99,7 +99,7 @@ def append(self, tup): if '_nodemap' in vars(self): self._nodemap[tup[7]] = len(self) - data = _pack(self.index_format, *tup) + data = self.index_format.pack(*tup) self._extra.append(data) def _check_index(self, i): @@ -117,7 +117,7 @@ else: index = self._calculate_index(i) data = self._data[index : index + self.index_size] - r = _unpack(self.index_format, data) + r = self.index_format.unpack(data) if self._lgt and i == 0: r = (offset_type(0, gettype(r[0])),) + r[1:] return r @@ -243,7 +243,7 @@ class Index2Mixin(object): - index_format = revlog_constants.INDEX_ENTRY_V2.format + index_format = revlog_constants.INDEX_ENTRY_V2 index_size = revlog_constants.INDEX_ENTRY_V2.size null_item = (0, 0, 0, -1, -1, -1, -1, nullid, 0, 0)