This fix test-check-clang-format.t that has been complaining for a while.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
( )
This fix test-check-clang-format.t that has been complaining for a while.
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/cext/revlog.c (35 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
dc99520203a1 | c7c6c11fe1e4 | Pierre-Yves David | Apr 8 2021, 2:05 PM |
static const Py_ssize_t nullrev = -1; | static const Py_ssize_t nullrev = -1; | ||||
static Py_ssize_t inline_scan(indexObject *self, const char **offsets); | static Py_ssize_t inline_scan(indexObject *self, const char **offsets); | ||||
static int index_find_node(indexObject *self, const char *node); | static int index_find_node(indexObject *self, const char *node); | ||||
#if LONG_MAX == 0x7fffffffL | #if LONG_MAX == 0x7fffffffL | ||||
static const char *const v1_tuple_format = PY23("Kiiiiiis#", "Kiiiiiiy#"); | static const char *const v1_tuple_format = PY23("Kiiiiiis#", "Kiiiiiiy#"); | ||||
static const char *const v2_tuple_format = | static const char *const v2_tuple_format = PY23("Kiiiiiis#Ki", "Kiiiiiiy#Ki"); | ||||
PY23("Kiiiiiis#Ki", "Kiiiiiiy#Ki"); | |||||
#else | #else | ||||
static const char *const v1_tuple_format = PY23("kiiiiiis#", "kiiiiiiy#"); | static const char *const v1_tuple_format = PY23("kiiiiiis#", "kiiiiiiy#"); | ||||
static const char *const v2_tuple_format = | static const char *const v2_tuple_format = PY23("kiiiiiis#ki", "kiiiiiiy#ki"); | ||||
PY23("kiiiiiis#ki", "kiiiiiiy#ki"); | |||||
#endif | #endif | ||||
/* A RevlogNG v1 index entry is 64 bytes long. */ | /* A RevlogNG v1 index entry is 64 bytes long. */ | ||||
static const long v1_hdrsize = 64; | static const long v1_hdrsize = 64; | ||||
/* A Revlogv2 index entry is 96 bytes long. */ | /* A Revlogv2 index entry is 96 bytes long. */ | ||||
static const long v2_hdrsize = 96; | static const long v2_hdrsize = 96; | ||||
if (!PyArg_ParseTuple(obj, v1_tuple_format, &offset_flags, | if (!PyArg_ParseTuple(obj, v1_tuple_format, &offset_flags, | ||||
&comp_len, &uncomp_len, &base_rev, | &comp_len, &uncomp_len, &base_rev, | ||||
&link_rev, &parent_1, &parent_2, | &link_rev, &parent_1, &parent_2, | ||||
&c_node_id, &c_node_id_len)) { | &c_node_id, &c_node_id_len)) { | ||||
PyErr_SetString(PyExc_TypeError, "8-tuple required"); | PyErr_SetString(PyExc_TypeError, "8-tuple required"); | ||||
return NULL; | return NULL; | ||||
} | } | ||||
} else { | } else { | ||||
if (!PyArg_ParseTuple( | if (!PyArg_ParseTuple(obj, v2_tuple_format, &offset_flags, | ||||
obj, v2_tuple_format, &offset_flags, &comp_len, | &comp_len, &uncomp_len, &base_rev, | ||||
&uncomp_len, &base_rev, &link_rev, &parent_1, &parent_2, | &link_rev, &parent_1, &parent_2, | ||||
&c_node_id, &c_node_id_len, &sidedata_offset, &sidedata_comp_len)) { | &c_node_id, &c_node_id_len, | ||||
&sidedata_offset, &sidedata_comp_len)) { | |||||
PyErr_SetString(PyExc_TypeError, "10-tuple required"); | PyErr_SetString(PyExc_TypeError, "10-tuple required"); | ||||
return NULL; | return NULL; | ||||
} | } | ||||
} | } | ||||
if (c_node_id_len != self->nodelen) { | if (c_node_id_len != self->nodelen) { | ||||
PyErr_SetString(PyExc_TypeError, "invalid node"); | PyErr_SetString(PyExc_TypeError, "invalid node"); | ||||
return NULL; | return NULL; | ||||
This cannot be used outside of the context of sidedata rewriting, | This cannot be used outside of the context of sidedata rewriting, | ||||
inside the transaction that creates the given revision. */ | inside the transaction that creates the given revision. */ | ||||
static PyObject *index_replace_sidedata_info(indexObject *self, PyObject *args) | static PyObject *index_replace_sidedata_info(indexObject *self, PyObject *args) | ||||
{ | { | ||||
uint64_t sidedata_offset; | uint64_t sidedata_offset; | ||||
int rev; | int rev; | ||||
Py_ssize_t sidedata_comp_len; | Py_ssize_t sidedata_comp_len; | ||||
char *data; | char *data; | ||||
#if LONG_MAX == 0x7fffffffL | #if LONG_MAX == 0x7fffffffL | ||||
const char *const sidedata_format = PY23("nKi", "nKi"); | const char *const sidedata_format = PY23("nKi", "nKi"); | ||||
#else | #else | ||||
const char *const sidedata_format = PY23("nki", "nki"); | const char *const sidedata_format = PY23("nki", "nki"); | ||||
#endif | #endif | ||||
if (self->hdrsize == v1_hdrsize || self->inlined) { | if (self->hdrsize == v1_hdrsize || self->inlined) { | ||||
/* | /* | ||||
There is a bug in the transaction handling when going from an | There is a bug in the transaction handling when going from an | ||||
inline revlog to a separate index and data file. Turn it off until | inline revlog to a separate index and data file. Turn it off until | ||||
it's fixed, since v2 revlogs sometimes get rewritten on exchange. | it's fixed, since v2 revlogs sometimes get rewritten on exchange. | ||||
See issue6485. | See issue6485. | ||||
*/ | */ | ||||
} | } | ||||
if (rev < self->length) { | if (rev < self->length) { | ||||
PyErr_SetString( | PyErr_SetString( | ||||
PyExc_IndexError, | PyExc_IndexError, | ||||
"cannot rewrite entries outside of this transaction"); | "cannot rewrite entries outside of this transaction"); | ||||
return NULL; | return NULL; | ||||
} | } | ||||
/* Find the newly added node, offset from the "already on-disk" length */ | /* Find the newly added node, offset from the "already on-disk" length | ||||
*/ | |||||
data = self->added + self->hdrsize * (rev - self->length); | data = self->added + self->hdrsize * (rev - self->length); | ||||
putbe64(sidedata_offset, data + 64); | putbe64(sidedata_offset, data + 64); | ||||
putbe32(sidedata_comp_len, data + 72); | putbe32(sidedata_comp_len, data + 72); | ||||
Py_RETURN_NONE; | Py_RETURN_NONE; | ||||
} | } | ||||
static PyObject *index_stats(indexObject *self) | static PyObject *index_stats(indexObject *self) | ||||
{ | { | ||||
PyObject *obj = PyDict_New(); | PyObject *obj = PyDict_New(); | ||||
PyObject *s = NULL; | PyObject *s = NULL; | ||||
PyObject *t = NULL; | PyObject *t = NULL; | ||||
self->hdrsize = v1_hdrsize; | self->hdrsize = v1_hdrsize; | ||||
} | } | ||||
if (self->hdrsize == v1_hdrsize) { | if (self->hdrsize == v1_hdrsize) { | ||||
self->nullentry = | self->nullentry = | ||||
Py_BuildValue(PY23("iiiiiiis#", "iiiiiiiy#"), 0, 0, 0, -1, | Py_BuildValue(PY23("iiiiiiis#", "iiiiiiiy#"), 0, 0, 0, -1, | ||||
-1, -1, -1, nullid, self->nodelen); | -1, -1, -1, nullid, self->nodelen); | ||||
} else { | } else { | ||||
self->nullentry = Py_BuildValue( | self->nullentry = | ||||
PY23("iiiiiiis#ii", "iiiiiiiy#ii"), 0, 0, 0, -1, -1, -1, | Py_BuildValue(PY23("iiiiiiis#ii", "iiiiiiiy#ii"), 0, 0, 0, | ||||
-1, nullid, self->nodelen, 0, 0); | -1, -1, -1, -1, nullid, self->nodelen, 0, 0); | ||||
} | } | ||||
if (!self->nullentry) | if (!self->nullentry) | ||||
return -1; | return -1; | ||||
PyObject_GC_UnTrack(self->nullentry); | PyObject_GC_UnTrack(self->nullentry); | ||||
if (PyObject_GetBuffer(data_obj, &self->buf, PyBUF_SIMPLE) == -1) | if (PyObject_GetBuffer(data_obj, &self->buf, PyBUF_SIMPLE) == -1) | ||||
return -1; | return -1; |