mercurial/parsers.c
changeset 26041 8da628be211b
parent 26033 9e7d805925c8
child 26042 2a3010ba6f52
equal deleted inserted replaced
26039:84dcc37b1272 26041:8da628be211b
  1195 			}
  1195 			}
  1196 		}
  1196 		}
  1197 		Py_DECREF(val);
  1197 		Py_DECREF(val);
  1198 
  1198 
  1199 		/* Add its parents to the list of nodes to visit */
  1199 		/* Add its parents to the list of nodes to visit */
  1200 		if (revnum != -1) {
  1200 		if (revnum == -1)
  1201 			r = index_get_parents(self, revnum, parents, (int)len - 1);
  1201 			continue;
  1202 			if (r < 0)
  1202 		r = index_get_parents(self, revnum, parents, (int)len - 1);
  1203 				goto bail;
  1203 		if (r < 0)
  1204 
  1204 			goto bail;
  1205 			for (i = 0; i < 2; i++) {
  1205 		for (i = 0; i < 2; i++) {
  1206 				if (seen[parents[i] + 1] == 0 && parents[i] >= minroot) {
  1206 			if (seen[parents[i] + 1] == 0
  1207 					tovisit[lentovisit++] = parents[i];
  1207 			    && parents[i] >= minroot) {
  1208 					seen[parents[i] + 1] = 1;
  1208 				tovisit[lentovisit++] = parents[i];
  1209 				}
  1209 				seen[parents[i] + 1] = 1;
  1210 			}
  1210 			}
  1211 		}
  1211 		}
  1212 	}
  1212 	}
  1213 
  1213 
  1214 	/* Find all the nodes in between the roots we found and the heads
  1214 	/* Find all the nodes in between the roots we found and the heads
  1216 	if (includepath == 1) {
  1216 	if (includepath == 1) {
  1217 		minidx = minroot;
  1217 		minidx = minroot;
  1218 		if (minidx < 0)
  1218 		if (minidx < 0)
  1219 			minidx = 0;
  1219 			minidx = 0;
  1220 		for (i = minidx; i < len; i++) {
  1220 		for (i = minidx; i < len; i++) {
  1221 			if (seen[i + 1] == 1) {
  1221 			if (seen[i + 1] != 1)
  1222 				r = index_get_parents(self, i, parents, (int)len - 1);
  1222 				continue;
  1223 				/* Corrupted index file, error is set from index_get_parents */
  1223 			r = index_get_parents(self, i, parents, (int)len - 1);
  1224 				if (r < 0)
  1224 			/* Corrupted index file, error is set from
       
  1225 			 * index_get_parents */
       
  1226 			if (r < 0)
       
  1227 				goto bail;
       
  1228 			for (k = 0; k < 2; k++) {
       
  1229 				PyObject *p = PyInt_FromLong(parents[k]);
       
  1230 				if (p == NULL)
  1225 					goto bail;
  1231 					goto bail;
  1226 				for (k = 0; k < 2; k++) {
  1232 				if (PySet_Contains(reachable, p) == 1) {
  1227 					PyObject *p = PyInt_FromLong(parents[k]);
  1233 					val = PyInt_FromLong(i);
  1228 					if (p == NULL)
  1234 					if (val == NULL)
  1229 						goto bail;
  1235 						goto bail;
  1230 					if (PySet_Contains(reachable, p) == 1) {
  1236 					PySet_Add(reachable, val);
  1231 						val = PyInt_FromLong(i);
  1237 					Py_DECREF(val);
  1232 						if (val == NULL)
       
  1233 							goto bail;
       
  1234 						PySet_Add(reachable, val);
       
  1235 						Py_DECREF(val);
       
  1236 					}
       
  1237 					Py_DECREF(p);
       
  1238 				}
  1238 				}
       
  1239 				Py_DECREF(p);
  1239 			}
  1240 			}
  1240 		}
  1241 		}
  1241 	}
  1242 	}
  1242 
  1243 
  1243 	free(seen);
  1244 	free(seen);