Mercurial > public > mercurial-scm > hg
diff mercurial/cext/revlog.c @ 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 | 651e6df2b0a4 |
children | 0d8ff1f4ab0c 9f798c1b0d89 |
line wrap: on
line diff
--- a/mercurial/cext/revlog.c Wed Apr 14 20:32:53 2021 +0200 +++ b/mercurial/cext/revlog.c Mon Apr 05 12:22:25 2021 +0200 @@ -15,6 +15,7 @@ #include <stddef.h> #include <stdlib.h> #include <string.h> +#include <structmember.h> #include "bitmanipulation.h" #include "charencode.h" @@ -2866,6 +2867,12 @@ {NULL} /* Sentinel */ }; +static PyMemberDef index_members[] = { + {"entry_size", T_LONG, offsetof(indexObject, hdrsize), 0, + "size of an index entry"}, + {NULL} /* Sentinel */ +}; + PyTypeObject HgRevlogIndex_Type = { PyVarObject_HEAD_INIT(NULL, 0) /* header */ "parsers.index", /* tp_name */ @@ -2895,7 +2902,7 @@ 0, /* tp_iter */ 0, /* tp_iternext */ index_methods, /* tp_methods */ - 0, /* tp_members */ + index_members, /* tp_members */ index_getset, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */