Mercurial > public > mercurial-scm > hg
view rust/hg-pyo3/src/lib.rs @ 52771:2fb13c3f4496
rust: add GraphError::ParentOutOfOrder
This will be used in a follow-up commit that creates a data structure optimized
for inserting revisions in descending order, since it will need to fail if a
revision number is greater than its descendant (meaning the graph is corrupted).
author | Mitchell Kember <mkember@janestreet.com> |
---|---|
date | Fri, 07 Feb 2025 16:07:35 -0500 |
parents | 4c9e31984b3a |
children | 0f9ed7e7a71b |
line wrap: on
line source
use pyo3::prelude::*; mod ancestors; mod convert_cpython; mod dagops; mod exceptions; mod revision; mod util; #[pymodule] fn pyo3_rustext(py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> { m.add( "__doc__", "Mercurial core concepts - Rust implementation exposed via PyO3", )?; // the module's __name__ is pyo3_rustext, not mercurial.pyo3_rustext // (at least at this point). let name: String = m.getattr("__name__")?.extract()?; let dotted_name = format!("mercurial.{}", name); m.add_submodule(&ancestors::init_module(py, &dotted_name)?)?; m.add_submodule(&dagops::init_module(py, &dotted_name)?)?; m.add("GraphError", py.get_type::<exceptions::GraphError>())?; Ok(()) }