Mercurial > public > mercurial-scm > hg-stable
comparison tests/test-parseindex2.py @ 48536:52034c42c09d
rank: add a "rank" value to the revlog-entry tuple
The rank of a revision is the size of sub-graph it defines as a head. In other
words, the rank of X is the size of `ancestors(X)` (X included).
This is a property that can help various algorithm and we intend to store it in
changelog-v2. We start with adding this new information to the "entry tuple",
with a default value. We will start to compute and persist the rank later.
Differential Revision: https://phab.mercurial-scm.org/D11936
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 14 Dec 2021 23:56:38 +0100 |
parents | 2b69555e4875 |
children | 1bb62821f080 |
comparison
equal
deleted
inserted
replaced
48535:d5137c00ab17 | 48536:52034c42c09d |
---|---|
55 e = e + ( | 55 e = e + ( |
56 0, | 56 0, |
57 0, | 57 0, |
58 constants.COMP_MODE_INLINE, | 58 constants.COMP_MODE_INLINE, |
59 constants.COMP_MODE_INLINE, | 59 constants.COMP_MODE_INLINE, |
60 constants.RANK_UNKNOWN, | |
60 ) | 61 ) |
61 nodemap[e[7]] = n | 62 nodemap[e[7]] = n |
62 append(e) | 63 append(e) |
63 n += 1 | 64 n += 1 |
64 if e[1] < 0: | 65 if e[1] < 0: |
70 e = e + ( | 71 e = e + ( |
71 0, | 72 0, |
72 0, | 73 0, |
73 constants.COMP_MODE_INLINE, | 74 constants.COMP_MODE_INLINE, |
74 constants.COMP_MODE_INLINE, | 75 constants.COMP_MODE_INLINE, |
76 constants.RANK_UNKNOWN, | |
75 ) | 77 ) |
76 nodemap[e[7]] = n | 78 nodemap[e[7]] = n |
77 append(e) | 79 append(e) |
78 n += 1 | 80 n += 1 |
79 off += s | 81 off += s |
266 sha1nodeconstants.nullid, | 268 sha1nodeconstants.nullid, |
267 0, | 269 0, |
268 0, | 270 0, |
269 constants.COMP_MODE_INLINE, | 271 constants.COMP_MODE_INLINE, |
270 constants.COMP_MODE_INLINE, | 272 constants.COMP_MODE_INLINE, |
273 constants.RANK_UNKNOWN, | |
271 ) | 274 ) |
272 index, junk = parsers.parse_index2(data_inlined, True) | 275 index, junk = parsers.parse_index2(data_inlined, True) |
273 got = index[-1] | 276 got = index[-1] |
274 self.assertEqual(want, got) # inline data | 277 self.assertEqual(want, got) # inline data |
275 | 278 |
301 node, | 304 node, |
302 0, | 305 0, |
303 0, | 306 0, |
304 constants.COMP_MODE_INLINE, | 307 constants.COMP_MODE_INLINE, |
305 constants.COMP_MODE_INLINE, | 308 constants.COMP_MODE_INLINE, |
309 constants.RANK_UNKNOWN, | |
306 ) | 310 ) |
307 index.append(e) | 311 index.append(e) |
308 | 312 |
309 appendrev(4) | 313 appendrev(4) |
310 appendrev(5) | 314 appendrev(5) |