Patchwork [1,of,4] parsers: indentation change to make the next page more legible

login
register
mail settings
Submitter Laurent Charignon
Date Nov. 25, 2015, 1:19 a.m.
Message ID <3bd86861a1618aabe6ec.1448414348@dev5073.prn1.facebook.com>
Download mbox | patch
Permalink /patch/11642/
State Superseded
Delegated to: Yuya Nishihara
Headers show

Comments

Laurent Charignon - Nov. 25, 2015, 1:19 a.m.
# HG changeset patch
# User Laurent Charignon <lcharignon@fb.com>
# Date 1448411145 28800
#      Tue Nov 24 16:25:45 2015 -0800
# Node ID 3bd86861a1618aabe6ec7f2cde1223282f9569be
# Parent  397baacd694d0f8343888b64c200bfa926cdd893
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.

Patch

diff --git a/mercurial/parsers.c b/mercurial/parsers.c
--- a/mercurial/parsers.c
+++ b/mercurial/parsers.c
@@ -602,59 +602,59 @@ 
 	}
 	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",