# HG changeset patch # User Bryan O'Sullivan # Date 1337481858 25200 # Node ID 12a852c7c7633b6dbeca263b3bcf4ced0e4f587e # Parent bb446969efd4683869cc163aba626ddf27460dc1 parsers: reduce raw_length when truncating When stripping revs, we now update raw_length to correctly reflect the new end of the index. diff -r bb446969efd4 -r 12a852c7c763 mercurial/parsers.c --- 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; } /*