changeset 47142 | 4292bed8da7c |
parent 47012 | d55b71393907 |
child 47143 | 47ffc754989a |
47141:ac72eee94035 | 47142:4292bed8da7c |
---|---|
47 append = index.append |
47 append = index.append |
48 if inline: |
48 if inline: |
49 cache = (0, data) |
49 cache = (0, data) |
50 while off <= l: |
50 while off <= l: |
51 e = struct.unpack(indexformatng, data[off : off + s]) |
51 e = struct.unpack(indexformatng, data[off : off + s]) |
52 e = e + (0, 0) |
|
52 nodemap[e[7]] = n |
53 nodemap[e[7]] = n |
53 append(e) |
54 append(e) |
54 n += 1 |
55 n += 1 |
55 if e[1] < 0: |
56 if e[1] < 0: |
56 break |
57 break |
57 off += e[1] + s |
58 off += e[1] + s |
58 else: |
59 else: |
59 while off <= l: |
60 while off <= l: |
60 e = struct.unpack(indexformatng, data[off : off + s]) |
61 e = struct.unpack(indexformatng, data[off : off + s]) |
62 e = e + (0, 0) |
|
61 nodemap[e[7]] = n |
63 nodemap[e[7]] = n |
62 append(e) |
64 append(e) |
63 n += 1 |
65 n += 1 |
64 off += s |
66 off += s |
65 |
67 |
238 except TypeError: |
240 except TypeError: |
239 # pure version doesn't support this |
241 # pure version doesn't support this |
240 break |
242 break |
241 |
243 |
242 def testminusone(self): |
244 def testminusone(self): |
243 want = (0, 0, 0, -1, -1, -1, -1, sha1nodeconstants.nullid) |
245 want = (0, 0, 0, -1, -1, -1, -1, sha1nodeconstants.nullid, 0, 0) |
244 index, junk = parsers.parse_index2(data_inlined, True) |
246 index, junk = parsers.parse_index2(data_inlined, True) |
245 got = index[-1] |
247 got = index[-1] |
246 self.assertEqual(want, got) # inline data |
248 self.assertEqual(want, got) # inline data |
247 |
249 |
248 index, junk = parsers.parse_index2(data_non_inlined, False) |
250 index, junk = parsers.parse_index2(data_non_inlined, False) |