Patchwork D5459: parsers: remove long-dead parse_manifest method

login
register
mail settings
Submitter phabricator
Date Dec. 20, 2018, 12:33 p.m.
Message ID <1744f9a50bbe6db2ea2defd6e398fcfc@localhost.localdomain>
Download mbox | patch
Permalink /patch/37271/
State Not Applicable
Headers show

Comments

phabricator - Dec. 20, 2018, 12:33 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG55d6d0ff703b: parsers: remove long-dead parse_manifest method (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5459?vs=12908&id=12920

REVISION DETAIL
  https://phab.mercurial-scm.org/D5459

AFFECTED FILES
  mercurial/cext/parsers.c

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c
--- a/mercurial/cext/parsers.c
+++ b/mercurial/cext/parsers.c
@@ -38,85 +38,6 @@ 
 	return _dict_new_presized(expected_size);
 }
 
-/*
- * This code assumes that a manifest is stitched together with newline
- * ('\n') characters.
- */
-static PyObject *parse_manifest(PyObject *self, PyObject *args)
-{
-	PyObject *mfdict, *fdict;
-	char *str, *start, *end;
-	int len;
-
-	if (!PyArg_ParseTuple(
-	        args, PY23("O!O!s#:parse_manifest", "O!O!y#:parse_manifest"),
-	        &PyDict_Type, &mfdict, &PyDict_Type, &fdict, &str, &len))
-		goto quit;
-
-	start = str;
-	end = str + len;
-	while (start < end) {
-		PyObject *file = NULL, *node = NULL;
-		PyObject *flags = NULL;
-		char *zero = NULL, *newline = NULL;
-		ptrdiff_t nlen;
-
-		zero = memchr(start, '\0', end - start);
-		if (!zero) {
-			PyErr_SetString(PyExc_ValueError,
-			                "manifest entry has no separator");
-			goto quit;
-		}
-
-		newline = memchr(zero + 1, '\n', end - (zero + 1));
-		if (!newline) {
-			PyErr_SetString(PyExc_ValueError,
-			                "manifest contains trailing garbage");
-			goto quit;
-		}
-
-		file = PyBytes_FromStringAndSize(start, zero - start);
-
-		if (!file)
-			goto bail;
-
-		nlen = newline - zero - 1;
-
-		node = unhexlify(zero + 1, nlen > 40 ? 40 : (Py_ssize_t)nlen);
-		if (!node)
-			goto bail;
-
-		if (nlen > 40) {
-			flags = PyBytes_FromStringAndSize(zero + 41, nlen - 40);
-			if (!flags)
-				goto bail;
-
-			if (PyDict_SetItem(fdict, file, flags) == -1)
-				goto bail;
-		}
-
-		if (PyDict_SetItem(mfdict, file, node) == -1)
-			goto bail;
-
-		start = newline + 1;
-
-		Py_XDECREF(flags);
-		Py_XDECREF(node);
-		Py_XDECREF(file);
-		continue;
-	bail:
-		Py_XDECREF(flags);
-		Py_XDECREF(node);
-		Py_XDECREF(file);
-		goto quit;
-	}
-
-	Py_INCREF(Py_None);
-	return Py_None;
-quit:
-	return NULL;
-}
-
 static inline dirstateTupleObject *make_dirstate_tuple(char state, int mode,
                                                        int size, int mtime)
 {
@@ -690,7 +611,6 @@ 
     {"nonnormalotherparententries", nonnormalotherparententries, METH_VARARGS,
      "create a set containing non-normal and other parent entries of given "
      "dirstate\n"},
-    {"parse_manifest", parse_manifest, METH_VARARGS, "parse a manifest\n"},
     {"parse_dirstate", parse_dirstate, METH_VARARGS, "parse a dirstate\n"},
     {"parse_index2", parse_index2, METH_VARARGS, "parse a revlog index\n"},
     {"isasciistr", isasciistr, METH_VARARGS, "check if an ASCII string\n"},