Mercurial > public > mercurial-scm > hg-stable
diff tests/test-rust-ancestor.py @ 51262:578c049f0408
rust-index: using `hg::index::Index` in `hg-cpython::dagops`
Hooking `headrevs` to the Rust index is straightforward as long as
we go the `PySharedRef` way. Direct attempts of obtaining a reference
to the inner `hg::index::Index` fail for lifetime reasons: the reference
is bound to the GIL, yet the `as_set` local variable is considered to
be static (the borrow checker clearly does not realize or care that this
set only stores `Revision` values).
In `rank()`, the chosen solution is the simplest as far as `hg-cpython` is
concerned, but it has the defect of removing an implementation
that would be easily adaptable if the core index did implement `RankedGraph`
(returning the same error as long as only `REVLOGV1` is supported), but that
would introduce a direct dependency of `hg-core` on the ``vcsgraph` crate.
author | Georges Racinet <georges.racinet@octobus.net> |
---|---|
date | Sun, 29 Oct 2023 10:47:54 +0100 |
parents | 59d81768ad6d |
children | 03fdd4d7b5bd |
line wrap: on
line diff
--- a/tests/test-rust-ancestor.py Sat Oct 28 22:50:10 2023 +0200 +++ b/tests/test-rust-ancestor.py Sun Oct 29 10:47:54 2023 +0100 @@ -157,7 +157,7 @@ self.assertEqual(exc.args, ('InvalidRevision', wdirrev)) def testheadrevs(self): - idx = self.parseindex() + idx = self.parserustindex() self.assertEqual(dagop.headrevs(idx, [1, 2, 3]), {3})