comparison mercurial/revlog.py @ 47394:ac60a1366a49

revlog: move `offset_type` to `revlogutils` This multiple module are using this so it make sense to move it at the utility level. Differential Revision: https://phab.mercurial-scm.org/D10792
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 30 May 2021 16:19:36 +0200
parents 7a0ec25d5836
children 8230f0204eb8
comparison
equal deleted inserted replaced
47393:7a0ec25d5836 47394:ac60a1366a49
70 dagop, 70 dagop,
71 error, 71 error,
72 mdiff, 72 mdiff,
73 policy, 73 policy,
74 pycompat, 74 pycompat,
75 revlogutils,
75 templatefilters, 76 templatefilters,
76 util, 77 util,
77 ) 78 )
78 from .interfaces import ( 79 from .interfaces import (
79 repository, 80 repository,
142 ellipsisprocessor = ( 143 ellipsisprocessor = (
143 ellipsisreadprocessor, 144 ellipsisreadprocessor,
144 ellipsiswriteprocessor, 145 ellipsiswriteprocessor,
145 ellipsisrawprocessor, 146 ellipsisrawprocessor,
146 ) 147 )
147
148
149 def offset_type(offset, type):
150 if (type & ~flagutil.REVIDX_KNOWN_FLAGS) != 0:
151 raise ValueError(b'unknown revlog index flags')
152 return int(int(offset) << 16 | type)
153 148
154 149
155 def _verify_revision(rl, skipflags, state, node): 150 def _verify_revision(rl, skipflags, state, node):
156 """Verify the integrity of the given revlog ``node`` while providing a hook 151 """Verify the integrity of the given revlog ``node`` while providing a hook
157 point for extensions to influence the operation.""" 152 point for extensions to influence the operation."""
2588 # we can easily detect empty sidedata and they will be no different 2583 # we can easily detect empty sidedata and they will be no different
2589 # than ones we manually add. 2584 # than ones we manually add.
2590 sidedata_offset = 0 2585 sidedata_offset = 0
2591 2586
2592 e = ( 2587 e = (
2593 offset_type(offset, flags), 2588 revlogutils.offset_type(offset, flags),
2594 deltainfo.deltalen, 2589 deltainfo.deltalen,
2595 textlen, 2590 textlen,
2596 deltainfo.base, 2591 deltainfo.base,
2597 link, 2592 link,
2598 p1r, 2593 p1r,