Mercurial > public > mercurial-scm > hg
changeset 52849:d0c0ad938eb9
rust-pyo3-dirstate: module definition
author | Georges Racinet <georges.racinet@cloudcrane.io> |
---|---|
date | Fri, 24 Jan 2025 15:58:18 +0100 |
parents | b61115f5d216 |
children | ffda57aa98fa |
files | rust/hg-pyo3/src/dirstate.rs rust/hg-pyo3/src/lib.rs |
diffstat | 2 files changed, 25 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rust/hg-pyo3/src/dirstate.rs Fri Jan 24 15:58:18 2025 +0100 @@ -0,0 +1,23 @@ +// dirstate.rs +// +// Copyright 2019 Raphaël Gomès <rgomes@octobus.net> +// 2025 Georges Racinet <georges.racinet@cloudcrane.io> +// +// This software may be used and distributed according to the terms of the +// GNU General Public License version 2 or any later version. + +//! Bindings for the `hg::dirstate` module provided by the +//! `hg-core` package. +//! +//! From Python, this will be seen as `mercurial.pyo3_rustext.dirstate` +use crate::utils::new_submodule; +use pyo3::prelude::*; + +pub fn init_module<'py>( + py: Python<'py>, + package: &str, +) -> PyResult<Bound<'py, PyModule>> { + let m = new_submodule(py, package, "dirstate")?; + m.add("__doc__", "Dirstate - Rust implementation exposed via PyO3")?; + Ok(m) +}
--- a/rust/hg-pyo3/src/lib.rs Wed Feb 12 09:37:55 2025 -0500 +++ b/rust/hg-pyo3/src/lib.rs Fri Jan 24 15:58:18 2025 +0100 @@ -2,6 +2,7 @@ mod ancestors; mod dagops; +mod dirstate; mod discovery; mod exceptions; mod node; @@ -23,6 +24,7 @@ m.add_submodule(&ancestors::init_module(py, &dotted_name)?)?; m.add_submodule(&dagops::init_module(py, &dotted_name)?)?; + m.add_submodule(&dirstate::init_module(py, &dotted_name)?)?; m.add_submodule(&discovery::init_module(py, &dotted_name)?)?; m.add_submodule(&revlog::init_module(py, &dotted_name)?)?; m.add("GraphError", py.get_type::<exceptions::GraphError>())?;