Mercurial > public > mercurial-scm > hg-stable
diff rust/hg-cpython/src/revlog.rs @ 46974:3c9208702db3
revlog: replace revlog._io.size with a new revlog.index.entry_size
The `revlogio` class is mostly a relic from the past. Once in charge of the full
revlog related Input/Output code, that class gradually lost responsibilities to
the point where more IO are now done by `revlog.index` objects or revlog objects
themself. I would like to ultimately remove the `revlogio` class, to do so I
start simple with move the "entry size" information on the index. (The index is
already responsible of the binary unpacking, so it knows the size.
Differential Revision: https://phab.mercurial-scm.org/D10309
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 05 Apr 2021 12:22:25 +0200 |
parents | 18a261b11b20 |
children | 0d8ff1f4ab0c |
line wrap: on
line diff
--- a/rust/hg-cpython/src/revlog.rs Wed Apr 14 20:32:53 2021 +0200 +++ b/rust/hg-cpython/src/revlog.rs Mon Apr 05 12:22:25 2021 +0200 @@ -12,8 +12,8 @@ use cpython::{ buffer::{Element, PyBuffer}, exc::{IndexError, ValueError}, - ObjectProtocol, PyBytes, PyClone, PyDict, PyErr, PyModule, PyObject, - PyResult, PyString, PyTuple, Python, PythonObject, ToPyObject, + ObjectProtocol, PyBytes, PyClone, PyDict, PyErr, PyInt, PyModule, + PyObject, PyResult, PyString, PyTuple, Python, PythonObject, ToPyObject, }; use hg::{ nodemap::{Block, NodeMapError, NodeTree}, @@ -285,6 +285,10 @@ self.inner_update_nodemap_data(py, docket, nm_data) } + @property + def entry_size(&self) -> PyResult<PyInt> { + self.cindex(py).borrow().inner().getattr(py, "entry_size")?.extract::<PyInt>(py) + } });