Show More
@@ -2522,7 +2522,10 b' static int index_slice_del(indexObject *' | |||
|
2522 | 2522 | index_invalidate_added(self, 0); |
|
2523 | 2523 | if (self->ntrev > start) |
|
2524 | 2524 | self->ntrev = (int)start; |
|
2525 | } else if (self->added) { | |
|
2526 | Py_CLEAR(self->added); | |
|
2525 | 2527 | } |
|
2528 | ||
|
2526 | 2529 | self->length = start; |
|
2527 | 2530 | if (start < self->raw_length) { |
|
2528 | 2531 | if (self->cache) { |
@@ -247,6 +247,32 b' class parseindex2tests(unittest.TestCase' | |||
|
247 | 247 | got = index[-1] |
|
248 | 248 | self.assertEqual(want, got) # no inline data |
|
249 | 249 | |
|
250 | def testdelitemwithoutnodetree(self): | |
|
251 | index, _junk = parsers.parse_index2(data_non_inlined, False) | |
|
252 | ||
|
253 | def hexrev(rev): | |
|
254 | if rev == nullrev: | |
|
255 | return b'\xff\xff\xff\xff' | |
|
256 | else: | |
|
257 | return nodemod.bin('%08x' % rev) | |
|
258 | ||
|
259 | def appendrev(p1, p2=nullrev): | |
|
260 | # node won't matter for this test, let's just make sure | |
|
261 | # they don't collide. Other data don't matter either. | |
|
262 | node = hexrev(p1) + hexrev(p2) + b'.' * 12 | |
|
263 | index.append((0, 0, 12, 1, 34, p1, p2, node)) | |
|
264 | ||
|
265 | appendrev(4) | |
|
266 | appendrev(5) | |
|
267 | appendrev(6) | |
|
268 | self.assertEqual(len(index), 7) | |
|
269 | ||
|
270 | del index[1:7] | |
|
271 | ||
|
272 | # assertions that failed before correction | |
|
273 | self.assertEqual(len(index), 1) # was 4 | |
|
274 | self.assertEqual(index.headrevs(), [0]) # gave ValueError | |
|
275 | ||
|
250 | 276 | |
|
251 | 277 | if __name__ == '__main__': |
|
252 | 278 | import silenttestrunner |
General Comments 0
You need to be logged in to leave comments.
Login now