diff tests/test-rust-revlog.py @ 51191:13f58ce70299

rust-revlog: teach the revlog opening code to read the repo options This will become necessary as we start writing revlog data from Rust.
author Raphaël Gomès <rgomes@octobus.net>
date Mon, 18 Sep 2023 17:11:11 +0200
parents 6ec8387eb0be
children 7eea2e4109ae
line wrap: on
line diff
--- a/tests/test-rust-revlog.py	Tue Jun 27 17:34:51 2023 +0200
+++ b/tests/test-rust-revlog.py	Mon Sep 18 17:11:11 2023 +0200
@@ -1,3 +1,4 @@
+import struct
 import unittest
 
 try:
@@ -14,6 +15,8 @@
 
 from mercurial.testing import revlog as revlogtesting
 
+header = struct.unpack(">I", revlogtesting.data_non_inlined[:4])[0]
+
 
 @unittest.skipIf(
     rustext is None,
@@ -22,24 +25,24 @@
 class RustRevlogIndexTest(revlogtesting.RevlogBasedTestBase):
     def test_heads(self):
         idx = self.parseindex()
-        rustidx = revlog.MixedIndex(idx, revlogtesting.data_non_inlined)
+        rustidx = revlog.MixedIndex(idx, revlogtesting.data_non_inlined, header)
         self.assertEqual(rustidx.headrevs(), idx.headrevs())
 
     def test_get_cindex(self):
         # drop me once we no longer need the method for shortest node
         idx = self.parseindex()
-        rustidx = revlog.MixedIndex(idx, revlogtesting.data_non_inlined)
+        rustidx = revlog.MixedIndex(idx, revlogtesting.data_non_inlined, header)
         cidx = rustidx.get_cindex()
         self.assertTrue(idx is cidx)
 
     def test_len(self):
         idx = self.parseindex()
-        rustidx = revlog.MixedIndex(idx, revlogtesting.data_non_inlined)
+        rustidx = revlog.MixedIndex(idx, revlogtesting.data_non_inlined, header)
         self.assertEqual(len(rustidx), len(idx))
 
     def test_ancestors(self):
         idx = self.parseindex()
-        rustidx = revlog.MixedIndex(idx, revlogtesting.data_non_inlined)
+        rustidx = revlog.MixedIndex(idx, revlogtesting.data_non_inlined, header)
         lazy = LazyAncestors(rustidx, [3], 0, True)
         # we have two more references to the index:
         # - in its inner iterator for __contains__ and __bool__