comparison rust/hg-cpython/src/utils.rs @ 52185:e698e3e75420 stable

rust-cpython: add a TODO about repo reuse This will need to be done soon-ish to prevent any surprises.
author Rapha?l Gom?s <rgomes@octobus.net>
date Tue, 05 Nov 2024 15:18:32 +0100
parents de317a87ea6a
children 96b113d22b34
comparison
equal deleted inserted replaced
52184:e4b242f9d4d9 52185:e698e3e75420
62 } 62 }
63 63
64 /// Get a repository from a given [`PyObject`] path, and bubble up any error 64 /// Get a repository from a given [`PyObject`] path, and bubble up any error
65 /// that comes up. 65 /// that comes up.
66 pub fn repo_from_path(py: Python, repo_path: PyObject) -> Result<Repo, PyErr> { 66 pub fn repo_from_path(py: Python, repo_path: PyObject) -> Result<Repo, PyErr> {
67 // TODO make the Config a Python class and downcast it here, otherwise we
68 // lose CLI args and runtime overrides done in Python.
67 let config = 69 let config =
68 hgerror_to_pyerr(py, Config::load_non_repo().map_err(HgError::from))?; 70 hgerror_to_pyerr(py, Config::load_non_repo().map_err(HgError::from))?;
69 let py_bytes = &repo_path.extract::<PyBytes>(py)?; 71 let py_bytes = &repo_path.extract::<PyBytes>(py)?;
70 let repo_path = py_bytes.data(py); 72 let repo_path = py_bytes.data(py);
71 let repo = repo_error_to_pyerr( 73 let repo = repo_error_to_pyerr(