mercurial/cext/revlog.c
changeset 38850 6104b203bec8
parent 38848 c0d411ea6639
child 38851 781b2720d2ac
--- a/mercurial/cext/revlog.c	Fri Jul 20 14:25:59 2018 -0700
+++ b/mercurial/cext/revlog.c	Wed Aug 01 10:57:14 2018 -0700
@@ -272,16 +272,11 @@
 	return -1;
 }
 
-static PyObject *index_insert(indexObject *self, PyObject *args)
+static PyObject *index_append(indexObject *self, PyObject *obj)
 {
-	PyObject *obj;
 	char *node;
-	int index;
 	Py_ssize_t len;
 
-	if (!PyArg_ParseTuple(args, "iO", &index, &obj))
-		return NULL;
-
 	if (!PyTuple_Check(obj) || PyTuple_GET_SIZE(obj) != 8) {
 		PyErr_SetString(PyExc_TypeError, "8-tuple required");
 		return NULL;
@@ -292,15 +287,6 @@
 
 	len = index_length(self);
 
-	if (index < 0)
-		index += len;
-
-	if (index != len - 1) {
-		PyErr_SetString(PyExc_IndexError,
-				"insert only supported at index -1");
-		return NULL;
-	}
-
 	if (self->added == NULL) {
 		self->added = PyList_New(0);
 		if (self->added == NULL)
@@ -311,7 +297,7 @@
 		return NULL;
 
 	if (self->nt)
-		nt_insert(self, node, index);
+		nt_insert(self, node, len - 1);
 
 	Py_CLEAR(self->headrevs);
 	Py_RETURN_NONE;
@@ -2065,8 +2051,8 @@
 	 "get filtered head revisions"}, /* Can always do filtering */
 	{"deltachain", (PyCFunction)index_deltachain, METH_VARARGS,
 	 "determine revisions with deltas to reconstruct fulltext"},
-	{"insert", (PyCFunction)index_insert, METH_VARARGS,
-	 "insert an index entry"},
+	{"append", (PyCFunction)index_append, METH_O,
+	 "append an index entry"},
 	{"partialmatch", (PyCFunction)index_partialmatch, METH_VARARGS,
 	 "match a potentially ambiguous node ID"},
 	{"shortest", (PyCFunction)index_shortest, METH_VARARGS,