marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches.
REVISION SUMMARY This is clearer than "tuple" indexing. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D10980 AFFECTED FILES mercurial/cext/parsers.c mercurial/dirstate.py mercurial/pure/parsers.py CHANGE DETAILS diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py --- a/mercurial/pure/parsers.py +++ b/mercurial/pure/parsers.py @@ -76,6 +76,10 @@ return self._mode @property + def size(self): + return self._size + + @property def state(self): """ States are: diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -1309,7 +1309,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 --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c --- a/mercurial/cext/parsers.c +++ b/mercurial/cext/parsers.c @@ -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}, To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel