##// END OF EJS Templates
parsers: simplify the code computing the phases...
Laurent Charignon -
r25312:ee02728d default
parent child Browse files
Show More
@@ -1093,20 +1093,14 static PyObject *compute_phases_map_sets
1093 PyObject *ret = NULL;
1093 PyObject *ret = NULL;
1094 PyObject *phaseslist = NULL;
1094 PyObject *phaseslist = NULL;
1095 PyObject *phaseroots = NULL;
1095 PyObject *phaseroots = NULL;
1096 PyObject *rev = NULL;
1097 PyObject *p1 = NULL;
1098 PyObject *p2 = NULL;
1099 PyObject *phaseset = NULL;
1096 PyObject *phaseset = NULL;
1100 PyObject *phasessetlist = NULL;
1097 PyObject *phasessetlist = NULL;
1101 Py_ssize_t addlen = self->added ? PyList_GET_SIZE(self->added) : 0;
1102 Py_ssize_t len = index_length(self) - 1;
1098 Py_ssize_t len = index_length(self) - 1;
1103 Py_ssize_t numphase = 0;
1099 Py_ssize_t numphase = 0;
1104 Py_ssize_t minrevallphases = 0;
1100 Py_ssize_t minrevallphases = 0;
1105 Py_ssize_t minrevphase = 0;
1101 Py_ssize_t minrevphase = 0;
1106 Py_ssize_t i = 0;
1102 Py_ssize_t i = 0;
1107 int parent_1, parent_2;
1108 char *phases = NULL;
1103 char *phases = NULL;
1109 const char *data;
1110 long phase;
1104 long phase;
1111
1105
1112 if (!PyArg_ParseTuple(args, "O", &roots))
1106 if (!PyArg_ParseTuple(args, "O", &roots))
@@ -1142,21 +1136,10 static PyObject *compute_phases_map_sets
1142 }
1136 }
1143 /* Propagate the phase information from the roots to the revs */
1137 /* Propagate the phase information from the roots to the revs */
1144 if (minrevallphases != -1) {
1138 if (minrevallphases != -1) {
1145 for (i = minrevallphases; i < self->raw_length; i++) {
1139 int parents[2];
1146 data = index_deref(self, i);
1140 for (i = minrevallphases; i < len; i++) {
1147 set_phase_from_parents(phases, getbe32(data+24), getbe32(data+28), i);
1141 index_get_parents(self, i, parents);
1148 }
1142 set_phase_from_parents(phases, parents[0], parents[1], i);
1149 for (i = 0; i < addlen; i++) {
1150 rev = PyList_GET_ITEM(self->added, i);
1151 p1 = PyTuple_GET_ITEM(rev, 5);
1152 p2 = PyTuple_GET_ITEM(rev, 6);
1153 if (!PyInt_Check(p1) || !PyInt_Check(p2)) {
1154 PyErr_SetString(PyExc_TypeError, "revlog parents are invalid");
1155 goto release_phasesetlist;
1156 }
1157 parent_1 = (int)PyInt_AS_LONG(p1);
1158 parent_2 = (int)PyInt_AS_LONG(p2);
1159 set_phase_from_parents(phases, parent_1, parent_2, i+self->raw_length);
1160 }
1143 }
1161 }
1144 }
1162 /* Transform phase list to a python list */
1145 /* Transform phase list to a python list */
General Comments 0
You need to be logged in to leave comments. Login now