##// END OF EJS Templates
parsers: remove long-dead parse_manifest method...
Augie Fackler -
r41047:55d6d0ff default
parent child Browse files
Show More
@@ -38,85 +38,6 b' static PyObject *dict_new_presized(PyObj'
38 return _dict_new_presized(expected_size);
38 return _dict_new_presized(expected_size);
39 }
39 }
40
40
41 /*
42 * This code assumes that a manifest is stitched together with newline
43 * ('\n') characters.
44 */
45 static PyObject *parse_manifest(PyObject *self, PyObject *args)
46 {
47 PyObject *mfdict, *fdict;
48 char *str, *start, *end;
49 int len;
50
51 if (!PyArg_ParseTuple(
52 args, PY23("O!O!s#:parse_manifest", "O!O!y#:parse_manifest"),
53 &PyDict_Type, &mfdict, &PyDict_Type, &fdict, &str, &len))
54 goto quit;
55
56 start = str;
57 end = str + len;
58 while (start < end) {
59 PyObject *file = NULL, *node = NULL;
60 PyObject *flags = NULL;
61 char *zero = NULL, *newline = NULL;
62 ptrdiff_t nlen;
63
64 zero = memchr(start, '\0', end - start);
65 if (!zero) {
66 PyErr_SetString(PyExc_ValueError,
67 "manifest entry has no separator");
68 goto quit;
69 }
70
71 newline = memchr(zero + 1, '\n', end - (zero + 1));
72 if (!newline) {
73 PyErr_SetString(PyExc_ValueError,
74 "manifest contains trailing garbage");
75 goto quit;
76 }
77
78 file = PyBytes_FromStringAndSize(start, zero - start);
79
80 if (!file)
81 goto bail;
82
83 nlen = newline - zero - 1;
84
85 node = unhexlify(zero + 1, nlen > 40 ? 40 : (Py_ssize_t)nlen);
86 if (!node)
87 goto bail;
88
89 if (nlen > 40) {
90 flags = PyBytes_FromStringAndSize(zero + 41, nlen - 40);
91 if (!flags)
92 goto bail;
93
94 if (PyDict_SetItem(fdict, file, flags) == -1)
95 goto bail;
96 }
97
98 if (PyDict_SetItem(mfdict, file, node) == -1)
99 goto bail;
100
101 start = newline + 1;
102
103 Py_XDECREF(flags);
104 Py_XDECREF(node);
105 Py_XDECREF(file);
106 continue;
107 bail:
108 Py_XDECREF(flags);
109 Py_XDECREF(node);
110 Py_XDECREF(file);
111 goto quit;
112 }
113
114 Py_INCREF(Py_None);
115 return Py_None;
116 quit:
117 return NULL;
118 }
119
120 static inline dirstateTupleObject *make_dirstate_tuple(char state, int mode,
41 static inline dirstateTupleObject *make_dirstate_tuple(char state, int mode,
121 int size, int mtime)
42 int size, int mtime)
122 {
43 {
@@ -690,7 +611,6 b' static PyMethodDef methods[] = {'
690 {"nonnormalotherparententries", nonnormalotherparententries, METH_VARARGS,
611 {"nonnormalotherparententries", nonnormalotherparententries, METH_VARARGS,
691 "create a set containing non-normal and other parent entries of given "
612 "create a set containing non-normal and other parent entries of given "
692 "dirstate\n"},
613 "dirstate\n"},
693 {"parse_manifest", parse_manifest, METH_VARARGS, "parse a manifest\n"},
694 {"parse_dirstate", parse_dirstate, METH_VARARGS, "parse a dirstate\n"},
614 {"parse_dirstate", parse_dirstate, METH_VARARGS, "parse a dirstate\n"},
695 {"parse_index2", parse_index2, METH_VARARGS, "parse a revlog index\n"},
615 {"parse_index2", parse_index2, METH_VARARGS, "parse a revlog index\n"},
696 {"isasciistr", isasciistr, METH_VARARGS, "check if an ASCII string\n"},
616 {"isasciistr", isasciistr, METH_VARARGS, "check if an ASCII string\n"},
General Comments 0
You need to be logged in to leave comments. Login now