Submitter | Boris Feld |
---|---|
Date | Nov. 15, 2018, 10:38 a.m. |
Message ID | <7d80481596f245d7f299.1542278323@localhost.localdomain> |
Download | mbox | patch |
Permalink | /patch/36596/ |
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 @@ -206,6 +206,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