mercurial/parsers.c
changeset 26042 2a3010ba6f52
parent 26041 8da628be211b
child 26043 f2f0a3ab6e41
equal deleted inserted replaced
26041:8da628be211b 26042:2a3010ba6f52
  1112 	long minroot;
  1112 	long minroot;
  1113 	PyObject *includepatharg = NULL;
  1113 	PyObject *includepatharg = NULL;
  1114 	int includepath = 0;
  1114 	int includepath = 0;
  1115 	/* heads is a list */
  1115 	/* heads is a list */
  1116 	PyObject *heads = NULL;
  1116 	PyObject *heads = NULL;
  1117 	Py_ssize_t numheads;
       
  1118 	/* roots is a set */
  1117 	/* roots is a set */
  1119 	PyObject *roots = NULL;
  1118 	PyObject *roots = NULL;
  1120 	PyObject *reachable = NULL;
  1119 	PyObject *reachable = NULL;
  1121 
  1120 
  1122 	PyObject *val;
  1121 	PyObject *val;
  1123 	Py_ssize_t len = index_length(self) - 1;
  1122 	Py_ssize_t len = index_length(self) - 1;
  1124 	long revnum;
  1123 	long revnum;
  1125 	Py_ssize_t k;
  1124 	Py_ssize_t k;
  1126 	Py_ssize_t i;
  1125 	Py_ssize_t i;
       
  1126 	Py_ssize_t l;
  1127 	int r;
  1127 	int r;
  1128 	int minidx;
  1128 	int minidx;
  1129 	int parents[2];
  1129 	int parents[2];
  1130 
  1130 
  1131 	/* Internal data structure:
  1131 	/* Internal data structure:
  1162 		PyErr_NoMemory();
  1162 		PyErr_NoMemory();
  1163 		goto bail;
  1163 		goto bail;
  1164 	}
  1164 	}
  1165 
  1165 
  1166 	/* Populate tovisit with all the heads */
  1166 	/* Populate tovisit with all the heads */
  1167 	numheads = PyList_GET_SIZE(heads);
  1167 	l = PyList_GET_SIZE(heads);
  1168 	for (i = 0; i < numheads; i++) {
  1168 	for (i = 0; i < l; i++) {
  1169 		revnum = PyInt_AsLong(PyList_GET_ITEM(heads, i));
  1169 		revnum = PyInt_AsLong(PyList_GET_ITEM(heads, i));
  1170 		if (revnum == -1 && PyErr_Occurred())
  1170 		if (revnum == -1 && PyErr_Occurred())
  1171 			goto bail;
  1171 			goto bail;
  1172 		if (revnum + 1 < 0 || revnum + 1 >= len + 1) {
  1172 		if (revnum + 1 < 0 || revnum + 1 >= len + 1) {
  1173 			PyErr_SetString(PyExc_IndexError, "head out of range");
  1173 			PyErr_SetString(PyExc_IndexError, "head out of range");