# HG changeset patch # User Pierre-Yves David # Date 1625358864 -7200 # Node ID 0e5800c88eb4128ca36675df133fc8950810bf42 # Parent 8e4b9fe3133489211bb480c16c2d3d3b1000e6c2 dirstate-entry: add a `size` property This is clearer than "tuple" indexing. Differential Revision: https://phab.mercurial-scm.org/D10980 diff -r 8e4b9fe31334 -r 0e5800c88eb4 mercurial/cext/parsers.c --- a/mercurial/cext/parsers.c Sun Jul 04 02:33:21 2021 +0200 +++ b/mercurial/cext/parsers.c Sun Jul 04 02:34:24 2021 +0200 @@ -174,6 +174,11 @@ return PyInt_FromLong(self->mode); }; +static PyObject *dirstatetuple_get_size(dirstateTupleObject *self) +{ + return PyInt_FromLong(self->size); +}; + static PyObject *dirstatetuple_get_state(dirstateTupleObject *self) { return PyBytes_FromStringAndSize(&self->state, 1); @@ -244,6 +249,7 @@ static PyGetSetDef dirstatetuple_getset[] = { {"mode", (getter)dirstatetuple_get_mode, NULL, "mode", NULL}, + {"size", (getter)dirstatetuple_get_size, NULL, "size", NULL}, {"state", (getter)dirstatetuple_get_state, NULL, "state", NULL}, {"tracked", (getter)dirstatetuple_get_tracked, NULL, "tracked", NULL}, {"added", (getter)dirstatetuple_get_added, NULL, "added", NULL}, diff -r 8e4b9fe31334 -r 0e5800c88eb4 mercurial/dirstate.py --- a/mercurial/dirstate.py Sun Jul 04 02:33:21 2021 +0200 +++ b/mercurial/dirstate.py Sun Jul 04 02:34:24 2021 +0200 @@ -1308,7 +1308,7 @@ # tuple members one by one. t = dget(fn) mode = t.mode - size = t[2] + size = t.size time = t[3] if not st and t.tracked: diff -r 8e4b9fe31334 -r 0e5800c88eb4 mercurial/pure/parsers.py --- a/mercurial/pure/parsers.py Sun Jul 04 02:33:21 2021 +0200 +++ b/mercurial/pure/parsers.py Sun Jul 04 02:34:24 2021 +0200 @@ -76,6 +76,10 @@ return self._mode @property + def size(self): + return self._size + + @property def state(self): """ States are: