mercurial/parsers.c
changeset 25280 8c8af4d8aca3
parent 25190 22438cfd11b5
child 25296 260fb5968de0
equal deleted inserted replaced
25278:858618d43524 25280:8c8af4d8aca3
  1175 	free(phases);
  1175 	free(phases);
  1176 release_none:
  1176 release_none:
  1177 	return ret;
  1177 	return ret;
  1178 }
  1178 }
  1179 
  1179 
       
  1180 static inline void index_get_parents(indexObject *self, int rev, int *ps)
       
  1181 {
       
  1182 	if (rev >= self->length - 1) {
       
  1183 		PyObject *tuple = PyList_GET_ITEM(self->added,
       
  1184 						  rev - self->length + 1);
       
  1185 		ps[0] = (int)PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 5));
       
  1186 		ps[1] = (int)PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 6));
       
  1187 	} else {
       
  1188 		const char *data = index_deref(self, rev);
       
  1189 		ps[0] = getbe32(data + 24);
       
  1190 		ps[1] = getbe32(data + 28);
       
  1191 	}
       
  1192 }
       
  1193 
  1180 static PyObject *index_headrevs(indexObject *self, PyObject *args)
  1194 static PyObject *index_headrevs(indexObject *self, PyObject *args)
  1181 {
  1195 {
  1182 	Py_ssize_t i, len, addlen;
  1196 	Py_ssize_t i, len, addlen;
  1183 	char *nothead = NULL;
  1197 	char *nothead = NULL;
  1184 	PyObject *heads = NULL;
  1198 	PyObject *heads = NULL;
  1685 		return -1;
  1699 		return -1;
  1686 	case -2:
  1700 	case -2:
  1687 		return 0;
  1701 		return 0;
  1688 	default:
  1702 	default:
  1689 		return 1;
  1703 		return 1;
  1690 	}
       
  1691 }
       
  1692 
       
  1693 static inline void index_get_parents(indexObject *self, int rev, int *ps)
       
  1694 {
       
  1695 	if (rev >= self->length - 1) {
       
  1696 		PyObject *tuple = PyList_GET_ITEM(self->added,
       
  1697 						  rev - self->length + 1);
       
  1698 		ps[0] = (int)PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 5));
       
  1699 		ps[1] = (int)PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 6));
       
  1700 	} else {
       
  1701 		const char *data = index_deref(self, rev);
       
  1702 		ps[0] = getbe32(data + 24);
       
  1703 		ps[1] = getbe32(data + 28);
       
  1704 	}
  1704 	}
  1705 }
  1705 }
  1706 
  1706 
  1707 typedef uint64_t bitmask;
  1707 typedef uint64_t bitmask;
  1708 
  1708