Show More
@@ -29,6 +29,17 b' py_class!(pub class MixedIndex |py| {' | |||||
29 | cindex::Index::new(py, cindex)?)) |
|
29 | cindex::Index::new(py, cindex)?)) | |
30 | } |
|
30 | } | |
31 |
|
31 | |||
|
32 | /// Compatibility layer used for Python consumers needing access to the C index | |||
|
33 | /// | |||
|
34 | /// Only use case so far is `scmutil.shortesthexnodeidprefix`, | |||
|
35 | /// that may need to build a custom `nodetree`, based on a specified revset. | |||
|
36 | /// With a Rust implementation of the nodemap, we will be able to get rid of | |||
|
37 | /// this, by exposing our own standalone nodemap class, | |||
|
38 | /// ready to accept `MixedIndex`. | |||
|
39 | def get_cindex(&self) -> PyResult<PyObject> { | |||
|
40 | Ok(self.cindex(py).borrow().inner().clone_ref(py)) | |||
|
41 | } | |||
|
42 | ||||
32 |
|
43 | |||
33 | // Reforwarded C index API |
|
44 | // Reforwarded C index API | |
34 |
|
45 |
@@ -25,6 +25,13 b' class RustRevlogIndexTest(revlogtesting.' | |||||
25 | rustidx = revlog.MixedIndex(idx) |
|
25 | rustidx = revlog.MixedIndex(idx) | |
26 | self.assertEqual(rustidx.headrevs(), idx.headrevs()) |
|
26 | self.assertEqual(rustidx.headrevs(), idx.headrevs()) | |
27 |
|
27 | |||
|
28 | def test_get_cindex(self): | |||
|
29 | # drop me once we no longer need the method for shortest node | |||
|
30 | idx = self.parseindex() | |||
|
31 | rustidx = revlog.MixedIndex(idx) | |||
|
32 | cidx = rustidx.get_cindex() | |||
|
33 | self.assertTrue(idx is cidx) | |||
|
34 | ||||
28 | def test_len(self): |
|
35 | def test_len(self): | |
29 | idx = self.parseindex() |
|
36 | idx = self.parseindex() | |
30 | rustidx = revlog.MixedIndex(idx) |
|
37 | rustidx = revlog.MixedIndex(idx) |
General Comments 0
You need to be logged in to leave comments.
Login now