Comments
Patch
@@ -25,6 +25,13 @@
rustidx = revlog.MixedIndex(idx)
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)
+ cidx = rustidx.get_cindex()
+ self.assertTrue(idx is cidx)
+
def test_len(self):
idx = self.parseindex()
rustidx = revlog.MixedIndex(idx)
@@ -29,6 +29,17 @@
cindex::Index::new(py, cindex)?))
}
+ /// Compatibility layer used for Python consumers needing access to the C index
+ ///
+ /// Only use case so far is `scmutil.shortesthexnodeidprefix`,
+ /// that may need to build a custom `nodetree`, based on a specified revset.
+ /// With a Rust implementation of the nodemap, we will be able to get rid of
+ /// this, by exposing our own standalone nodemap class,
+ /// ready to accept `MixedIndex`.
+ def get_cindex(&self) -> PyResult<PyObject> {
+ Ok(self.cindex(py).borrow().inner().clone_ref(py))
+ }
+
// Reforwarded C index API