Mercurial > public > mercurial-scm > hg-stable
diff mercurial/pure/parsers.py @ 47400:ac60a1366a49
revlog: move `offset_type` to `revlogutils`
This multiple module are using this so it make sense to move it at the utility
level.
Differential Revision: https://phab.mercurial-scm.org/D10792
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 30 May 2021 16:19:36 +0200 |
parents | 25ce16bf724b |
children | 084ed6a7c6fd |
line wrap: on
line diff
--- a/mercurial/pure/parsers.py Sat May 22 00:06:22 2021 +0200 +++ b/mercurial/pure/parsers.py Sun May 30 16:19:36 2021 +0200 @@ -17,6 +17,7 @@ from .. import ( error, pycompat, + revlogutils, util, ) @@ -42,10 +43,6 @@ return int(q & 0xFFFF) -def offset_type(offset, type): - return int(int(offset) << 16 | type) - - class BaseIndexObject(object): # Can I be passed to an algorithme implemented in Rust ? rust_ext_compat = 0 @@ -145,7 +142,8 @@ data = self._data[index : index + self.entry_size] r = self._unpack_entry(i, data) if self._lgt and i == 0: - r = (offset_type(0, gettype(r[0])),) + r[1:] + offset = revlogutils.offset_type(0, gettype(r[0])) + r = (offset,) + r[1:] return r def _unpack_entry(self, rev, data):