##// END OF EJS Templates
index: replace insert(-1, e) method by append(e) method...
Martin von Zweigbergk -
r38886:6104b203 default
parent child Browse files
Show More
@@ -80,7 +80,7 b' class bundlerevlog(revlog.revlog):'
80 # start, size, full unc. size, base (unused), link, p1, p2, node
80 # start, size, full unc. size, base (unused), link, p1, p2, node
81 e = (revlog.offset_type(start, flags), size, -1, baserev, link,
81 e = (revlog.offset_type(start, flags), size, -1, baserev, link,
82 self.rev(p1), self.rev(p2), node)
82 self.rev(p1), self.rev(p2), node)
83 self.index.insert(-1, e)
83 self.index.append(e)
84 self.nodemap[node] = n
84 self.nodemap[node] = n
85 self.bundlerevs.add(n)
85 self.bundlerevs.add(n)
86 n += 1
86 n += 1
@@ -713,7 +713,7 b' void dirs_module_init(PyObject *mod);'
713 void manifest_module_init(PyObject *mod);
713 void manifest_module_init(PyObject *mod);
714 void revlog_module_init(PyObject *mod);
714 void revlog_module_init(PyObject *mod);
715
715
716 static const int version = 5;
716 static const int version = 6;
717
717
718 static void module_init(PyObject *mod)
718 static void module_init(PyObject *mod)
719 {
719 {
@@ -272,16 +272,11 b' static int node_check(PyObject *obj, cha'
272 return -1;
272 return -1;
273 }
273 }
274
274
275 static PyObject *index_insert(indexObject *self, PyObject *args)
275 static PyObject *index_append(indexObject *self, PyObject *obj)
276 {
276 {
277 PyObject *obj;
278 char *node;
277 char *node;
279 int index;
280 Py_ssize_t len;
278 Py_ssize_t len;
281
279
282 if (!PyArg_ParseTuple(args, "iO", &index, &obj))
283 return NULL;
284
285 if (!PyTuple_Check(obj) || PyTuple_GET_SIZE(obj) != 8) {
280 if (!PyTuple_Check(obj) || PyTuple_GET_SIZE(obj) != 8) {
286 PyErr_SetString(PyExc_TypeError, "8-tuple required");
281 PyErr_SetString(PyExc_TypeError, "8-tuple required");
287 return NULL;
282 return NULL;
@@ -292,15 +287,6 b' static PyObject *index_insert(indexObjec'
292
287
293 len = index_length(self);
288 len = index_length(self);
294
289
295 if (index < 0)
296 index += len;
297
298 if (index != len - 1) {
299 PyErr_SetString(PyExc_IndexError,
300 "insert only supported at index -1");
301 return NULL;
302 }
303
304 if (self->added == NULL) {
290 if (self->added == NULL) {
305 self->added = PyList_New(0);
291 self->added = PyList_New(0);
306 if (self->added == NULL)
292 if (self->added == NULL)
@@ -311,7 +297,7 b' static PyObject *index_insert(indexObjec'
311 return NULL;
297 return NULL;
312
298
313 if (self->nt)
299 if (self->nt)
314 nt_insert(self, node, index);
300 nt_insert(self, node, len - 1);
315
301
316 Py_CLEAR(self->headrevs);
302 Py_CLEAR(self->headrevs);
317 Py_RETURN_NONE;
303 Py_RETURN_NONE;
@@ -2065,8 +2051,8 b' static PyMethodDef index_methods[] = {'
2065 "get filtered head revisions"}, /* Can always do filtering */
2051 "get filtered head revisions"}, /* Can always do filtering */
2066 {"deltachain", (PyCFunction)index_deltachain, METH_VARARGS,
2052 {"deltachain", (PyCFunction)index_deltachain, METH_VARARGS,
2067 "determine revisions with deltas to reconstruct fulltext"},
2053 "determine revisions with deltas to reconstruct fulltext"},
2068 {"insert", (PyCFunction)index_insert, METH_VARARGS,
2054 {"append", (PyCFunction)index_append, METH_O,
2069 "insert an index entry"},
2055 "append an index entry"},
2070 {"partialmatch", (PyCFunction)index_partialmatch, METH_VARARGS,
2056 {"partialmatch", (PyCFunction)index_partialmatch, METH_VARARGS,
2071 "match a potentially ambiguous node ID"},
2057 "match a potentially ambiguous node ID"},
2072 {"shortest", (PyCFunction)index_shortest, METH_VARARGS,
2058 {"shortest", (PyCFunction)index_shortest, METH_VARARGS,
@@ -69,7 +69,7 b' def _importfrom(pkgname, modname):'
69 (r'cext', r'bdiff'): 3,
69 (r'cext', r'bdiff'): 3,
70 (r'cext', r'mpatch'): 1,
70 (r'cext', r'mpatch'): 1,
71 (r'cext', r'osutil'): 4,
71 (r'cext', r'osutil'): 4,
72 (r'cext', r'parsers'): 5,
72 (r'cext', r'parsers'): 6,
73 }
73 }
74
74
75 # map import request to other package or module
75 # map import request to other package or module
@@ -41,8 +41,7 b' class BaseIndexObject(object):'
41 def __len__(self):
41 def __len__(self):
42 return self._lgt + len(self._extra) + 1
42 return self._lgt + len(self._extra) + 1
43
43
44 def insert(self, i, tup):
44 def append(self, tup):
45 assert i == -1
46 self._extra.append(tup)
45 self._extra.append(tup)
47
46
48 def _fix_index(self, i):
47 def _fix_index(self, i):
@@ -2549,7 +2549,7 b' class revlog(object):'
2549
2549
2550 e = (offset_type(offset, flags), l, textlen,
2550 e = (offset_type(offset, flags), l, textlen,
2551 base, link, p1r, p2r, node)
2551 base, link, p1r, p2r, node)
2552 self.index.insert(-1, e)
2552 self.index.append(e)
2553 self.nodemap[node] = curr
2553 self.nodemap[node] = curr
2554
2554
2555 entry = self._io.packentry(e, self.node, self.version, curr)
2555 entry = self._io.packentry(e, self.node, self.version, curr)
@@ -73,7 +73,7 b' class unionrevlog(revlog.revlog):'
73 # I have no idea if csize is valid in the base revlog context.
73 # I have no idea if csize is valid in the base revlog context.
74 e = (flags, None, rsize, base,
74 e = (flags, None, rsize, base,
75 link, self.rev(p1node), self.rev(p2node), node)
75 link, self.rev(p1node), self.rev(p2node), node)
76 self.index.insert(-1, e)
76 self.index.append(e)
77 self.nodemap[node] = n
77 self.nodemap[node] = n
78 self.bundlerevs.add(n)
78 self.bundlerevs.add(n)
79 n += 1
79 n += 1
General Comments 0
You need to be logged in to leave comments. Login now