parsers: reduce raw_length when truncating
When stripping revs, we now update raw_length to correctly reflect
the new end of the index.
--- a/mercurial/parsers.c Tue May 22 22:08:41 2012 +0200
+++ b/mercurial/parsers.c Sat May 19 19:44:18 2012 -0700
@@ -930,6 +930,7 @@
{
Py_ssize_t start, stop, step, slicelength;
Py_ssize_t length = index_length(self);
+ int ret = 0;
if (PySlice_GetIndicesEx((PySliceObject*)item, length,
&start, &stop, &step, &slicelength) < 0)
@@ -975,7 +976,9 @@
self->ntrev = (int)start;
}
self->length = start + 1;
- return 0;
+ if (start < self->raw_length)
+ self->raw_length = start;
+ goto done;
}
if (self->nt) {
@@ -983,10 +986,11 @@
if (self->ntrev > start)
self->ntrev = (int)start;
}
- return self->added
- ? PyList_SetSlice(self->added, start - self->length + 1,
- PyList_GET_SIZE(self->added), NULL)
- : 0;
+ if (self->added)
+ ret = PyList_SetSlice(self->added, start - self->length + 1,
+ PyList_GET_SIZE(self->added), NULL);
+done:
+ return ret;
}
/*