Mercurial > hg-stable
changeset 16784:12a852c7c763
parsers: reduce raw_length when truncating
When stripping revs, we now update raw_length to correctly reflect
the new end of the index.
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Sat, 19 May 2012 19:44:18 -0700 |
parents | bb446969efd4 |
children | 1dc08dc63c09 |
files | mercurial/parsers.c |
diffstat | 1 files changed, 9 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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; } /*