Mercurial > hg
comparison mercurial/revlogutils/__init__.py @ 48499: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 | 34cc102c73f5 |
children | 6000f5b25c9b |
comparison
equal
deleted
inserted
replaced
48498:d5137c00ab17 | 48499:52034c42c09d |
---|---|
10 from ..thirdparty import attr | 10 from ..thirdparty import attr |
11 from ..interfaces import repository | 11 from ..interfaces import repository |
12 | 12 |
13 # See mercurial.revlogutils.constants for doc | 13 # See mercurial.revlogutils.constants for doc |
14 COMP_MODE_INLINE = 2 | 14 COMP_MODE_INLINE = 2 |
15 RANK_UNKNOWN = -1 | |
15 | 16 |
16 | 17 |
17 def offset_type(offset, type): | 18 def offset_type(offset, type): |
18 if (type & ~repository.REVISION_FLAGS_KNOWN) != 0: | 19 if (type & ~repository.REVISION_FLAGS_KNOWN) != 0: |
19 raise ValueError(b'unknown revlog index flags: %d' % type) | 20 raise ValueError(b'unknown revlog index flags: %d' % type) |
32 data_uncompressed_length=-1, | 33 data_uncompressed_length=-1, |
33 data_compression_mode=COMP_MODE_INLINE, | 34 data_compression_mode=COMP_MODE_INLINE, |
34 sidedata_offset=0, | 35 sidedata_offset=0, |
35 sidedata_compressed_length=0, | 36 sidedata_compressed_length=0, |
36 sidedata_compression_mode=COMP_MODE_INLINE, | 37 sidedata_compression_mode=COMP_MODE_INLINE, |
38 rank=RANK_UNKNOWN, | |
37 ): | 39 ): |
38 """Build one entry from symbolic name | 40 """Build one entry from symbolic name |
39 | 41 |
40 This is useful to abstract the actual detail of how we build the entry | 42 This is useful to abstract the actual detail of how we build the entry |
41 tuple for caller who don't care about it. | 43 tuple for caller who don't care about it. |
54 node_id, | 56 node_id, |
55 sidedata_offset, | 57 sidedata_offset, |
56 sidedata_compressed_length, | 58 sidedata_compressed_length, |
57 data_compression_mode, | 59 data_compression_mode, |
58 sidedata_compression_mode, | 60 sidedata_compression_mode, |
61 rank, | |
59 ) | 62 ) |
60 | 63 |
61 | 64 |
62 @attr.s(slots=True, frozen=True) | 65 @attr.s(slots=True, frozen=True) |
63 class revisioninfo(object): | 66 class revisioninfo(object): |