Submitter | Boris Feld |
---|---|
Date | Nov. 12, 2018, 9:55 a.m. |
Message ID | <ef4813b8b4911e5a7330.1542016544@localhost.localdomain> |
Download | mbox | patch |
Permalink | /patch/36517/ |
State | Accepted |
Headers | show |
Comments
Patch
diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c --- a/mercurial/cext/revlog.c +++ b/mercurial/cext/revlog.c @@ -200,6 +200,18 @@ static inline uint64_t index_get_start(i return offset; } +static inline int index_get_length(indexObject *self, Py_ssize_t rev) +{ + if (rev >= self->length) { + PyObject *tuple = + PyList_GET_ITEM(self->added, rev - self->length); + return (int)PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 1)); + } else { + const char *data = index_deref(self, rev); + return getbe32(data + 8); + } +} + /* * RevlogNG format (all in big endian, data may be inlined): * 6 bytes: offset