Mercurial > hg
comparison mercurial/revlogutils/revlogv0.py @ 47397:8f87dcb46f53
revlog: use entry in revlogv0.py
This make things clearer and we can reply on some of the default value directly.
Differential Revision: https://phab.mercurial-scm.org/D10795
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 30 May 2021 17:11:21 +0200 |
parents | ac60a1366a49 |
children | c514936d92b4 |
comparison
equal
deleted
inserted
replaced
47396:8230f0204eb8 | 47397:8f87dcb46f53 |
---|---|
7 from __future__ import absolute_import | 7 from __future__ import absolute_import |
8 | 8 |
9 | 9 |
10 from ..node import sha1nodeconstants | 10 from ..node import sha1nodeconstants |
11 from .constants import ( | 11 from .constants import ( |
12 COMP_MODE_INLINE, | |
13 INDEX_ENTRY_V0, | 12 INDEX_ENTRY_V0, |
14 ) | 13 ) |
15 from ..i18n import _ | 14 from ..i18n import _ |
16 | 15 |
17 from .. import ( | 16 from .. import ( |
21 revlogutils, | 20 revlogutils, |
22 util, | 21 util, |
23 ) | 22 ) |
24 | 23 |
25 from . import ( | 24 from . import ( |
26 flagutil, | |
27 nodemap as nodemaputil, | 25 nodemap as nodemaputil, |
28 ) | 26 ) |
29 | 27 |
30 | 28 |
31 def getoffset(q): | 29 def getoffset(q): |
37 | 35 |
38 | 36 |
39 class revlogoldindex(list): | 37 class revlogoldindex(list): |
40 rust_ext_compat = 0 | 38 rust_ext_compat = 0 |
41 entry_size = INDEX_ENTRY_V0.size | 39 entry_size = INDEX_ENTRY_V0.size |
42 null_item = ( | 40 null_item = revlogutils.entry( |
43 0, | 41 data_offset=0, |
44 0, | 42 data_compressed_length=0, |
45 0, | 43 data_delta_base=node.nullrev, |
46 -1, | 44 link_rev=node.nullrev, |
47 -1, | 45 parent_rev_1=node.nullrev, |
48 -1, | 46 parent_rev_2=node.nullrev, |
49 -1, | 47 node_id=sha1nodeconstants.nullid, |
50 sha1nodeconstants.nullid, | |
51 0, | |
52 0, | |
53 COMP_MODE_INLINE, | |
54 COMP_MODE_INLINE, | |
55 ) | 48 ) |
56 | 49 |
57 @property | 50 @property |
58 def nodemap(self): | 51 def nodemap(self): |
59 msg = b"index.nodemap is deprecated, use index.[has_node|rev|get_rev]" | 52 msg = b"index.nodemap is deprecated, use index.[has_node|rev|get_rev]" |
135 while off + s <= l: | 128 while off + s <= l: |
136 cur = data[off : off + s] | 129 cur = data[off : off + s] |
137 off += s | 130 off += s |
138 e = INDEX_ENTRY_V0.unpack(cur) | 131 e = INDEX_ENTRY_V0.unpack(cur) |
139 # transform to revlogv1 format | 132 # transform to revlogv1 format |
140 e2 = ( | 133 e2 = revlogutils.entry( |
141 revlogutils.offset_type(e[0], 0), | 134 data_offset=e[0], |
142 e[1], | 135 data_compressed_length=e[1], |
143 -1, | 136 data_delta_base=e[2], |
144 e[2], | 137 link_rev=e[3], |
145 e[3], | 138 parent_rev_1=nodemap.get(e[4], node.nullrev), |
146 nodemap.get(e[4], node.nullrev), | 139 parent_rev_2=nodemap.get(e[5], node.nullrev), |
147 nodemap.get(e[5], node.nullrev), | 140 node_id=e[6], |
148 e[6], | |
149 0, # no side data support | |
150 0, # no side data support | |
151 COMP_MODE_INLINE, | |
152 ) | 141 ) |
153 index.append(e2) | 142 index.append(e2) |
154 nodemap[e[6]] = n | 143 nodemap[e[6]] = n |
155 n += 1 | 144 n += 1 |
156 | 145 |