diff tests/test-rust-revlog.py @ 52808:adf91dfe6c04

rust-pyo3-index: _index_headrevs This one demonstrates that why the `with_index_read` and similar helpers are useful and was actually the main motivation for doing them: if we kept the borrow used to grab the index before updating the caches, there would be a panic when calling `borrow_mut`. This was confirmed with an earlier version by the Python test. There are perhaps some internal API clarifications to be made, as the method updating the cache does a seemingly useless return), but we are keeping it as it was in `hg-cpython`.
author Georges Racinet <georges.racinet@cloudcrane.io>
date Wed, 25 Dec 2024 19:06:59 +0100
parents 6a70e4931773
children 3fcd86374074
line wrap: on
line diff
--- a/tests/test-rust-revlog.py	Wed Dec 25 19:05:27 2024 +0100
+++ b/tests/test-rust-revlog.py	Wed Dec 25 19:06:59 2024 +0100
@@ -58,6 +58,10 @@
         self.assertEqual(idx[0], as_tuple)
         self.assertEqual(idx[self.node0], 0)
 
+    def test_heads(self):
+        idx = self.parserustindex()
+        self.assertEqual(idx.headrevs(), [3])
+
     def test_index_append(self):
         idx = self.parserustindex(data=b'')
         self.assertEqual(len(idx), 0)
@@ -173,10 +177,6 @@
 ):
     """For reference"""
 
-    def test_heads(self):
-        idx = self.parserustindex()
-        self.assertEqual(idx.headrevs(), [3])
-
     def test_ancestors(self):
         rustidx = self.parserustindex()
         lazy = LazyAncestors(rustidx, [3], 0, True)