diff mercurial/revlog.py @ 47400: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
line wrap: on
line diff
--- a/mercurial/revlog.py	Sat May 22 00:06:22 2021 +0200
+++ b/mercurial/revlog.py	Sun May 30 16:19:36 2021 +0200
@@ -72,6 +72,7 @@
     mdiff,
     policy,
     pycompat,
+    revlogutils,
     templatefilters,
     util,
 )
@@ -146,12 +147,6 @@
 )
 
 
-def offset_type(offset, type):
-    if (type & ~flagutil.REVIDX_KNOWN_FLAGS) != 0:
-        raise ValueError(b'unknown revlog index flags')
-    return int(int(offset) << 16 | type)
-
-
 def _verify_revision(rl, skipflags, state, node):
     """Verify the integrity of the given revlog ``node`` while providing a hook
     point for extensions to influence the operation."""
@@ -2590,7 +2585,7 @@
             sidedata_offset = 0
 
         e = (
-            offset_type(offset, flags),
+            revlogutils.offset_type(offset, flags),
             deltainfo.deltalen,
             textlen,
             deltainfo.base,