[PATCH 1 of 4 V2] parsers: indentation change to make the next page more legible
Laurent Charignon
lcharignon at fb.com
Mon Nov 30 18:52:43 CST 2015
# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1448411145 28800
# Tue Nov 24 16:25:45 2015 -0800
# Node ID a86356722e51056c2bbfd6accae954ca386d92e1
# Parent 156985f2dec008240b93fb440ebe0f0301e8581f
parsers: indentation change to make the next page more legible
The next patch introduces a change of indentation that would make it harder
to review.
diff --git a/mercurial/parsers.c b/mercurial/parsers.c
--- a/mercurial/parsers.c
+++ b/mercurial/parsers.c
@@ -602,59 +602,59 @@ static PyObject *pack_dirstate(PyObject
}
memcpy(p, s, l);
p += 20;
+ if (0 == 0) {
+ for (pos = 0; PyDict_Next(map, &pos, &k, &v); ) {
+ dirstateTupleObject *tuple;
+ char state;
+ int mode, size, mtime;
+ Py_ssize_t len, l;
+ PyObject *o;
+ char *t;
- for (pos = 0; PyDict_Next(map, &pos, &k, &v); ) {
- dirstateTupleObject *tuple;
- char state;
- int mode, size, mtime;
- Py_ssize_t len, l;
- PyObject *o;
- char *t;
+ if (!dirstate_tuple_check(v)) {
+ PyErr_SetString(PyExc_TypeError,
+ "expected a dirstate tuple");
+ goto bail;
+ }
+ tuple = (dirstateTupleObject *)v;
- if (!dirstate_tuple_check(v)) {
- PyErr_SetString(PyExc_TypeError,
- "expected a dirstate tuple");
- goto bail;
+ state = tuple->state;
+ mode = tuple->mode;
+ size = tuple->size;
+ mtime = tuple->mtime;
+ if (state == 'n' && mtime == now) {
+ /* See pure/parsers.py:pack_dirstate for why we do
+ * this. */
+ mtime = -1;
+ mtime_unset = (PyObject *)make_dirstate_tuple(
+ state, mode, size, mtime);
+ if (!mtime_unset)
+ goto bail;
+ if (PyDict_SetItem(map, k, mtime_unset) == -1)
+ goto bail;
+ Py_DECREF(mtime_unset);
+ mtime_unset = NULL;
+ }
+ *p++ = state;
+ putbe32((uint32_t)mode, p);
+ putbe32((uint32_t)size, p + 4);
+ putbe32((uint32_t)mtime, p + 8);
+ t = p + 12;
+ p += 16;
+ len = PyString_GET_SIZE(k);
+ memcpy(p, PyString_AS_STRING(k), len);
+ p += len;
+ o = PyDict_GetItem(copymap, k);
+ if (o) {
+ *p++ = '\0';
+ l = PyString_GET_SIZE(o);
+ memcpy(p, PyString_AS_STRING(o), l);
+ p += l;
+ len += l + 1;
+ }
+ putbe32((uint32_t)len, t);
}
- tuple = (dirstateTupleObject *)v;
-
- state = tuple->state;
- mode = tuple->mode;
- size = tuple->size;
- mtime = tuple->mtime;
- if (state == 'n' && mtime == now) {
- /* See pure/parsers.py:pack_dirstate for why we do
- * this. */
- mtime = -1;
- mtime_unset = (PyObject *)make_dirstate_tuple(
- state, mode, size, mtime);
- if (!mtime_unset)
- goto bail;
- if (PyDict_SetItem(map, k, mtime_unset) == -1)
- goto bail;
- Py_DECREF(mtime_unset);
- mtime_unset = NULL;
- }
- *p++ = state;
- putbe32((uint32_t)mode, p);
- putbe32((uint32_t)size, p + 4);
- putbe32((uint32_t)mtime, p + 8);
- t = p + 12;
- p += 16;
- len = PyString_GET_SIZE(k);
- memcpy(p, PyString_AS_STRING(k), len);
- p += len;
- o = PyDict_GetItem(copymap, k);
- if (o) {
- *p++ = '\0';
- l = PyString_GET_SIZE(o);
- memcpy(p, PyString_AS_STRING(o), l);
- p += l;
- len += l + 1;
- }
- putbe32((uint32_t)len, t);
}
-
pos = p - PyString_AS_STRING(packobj);
if (pos != nbytes) {
PyErr_Format(PyExc_SystemError, "bad dirstate size: %ld != %ld",
More information about the Mercurial-devel
mailing list