rust/hg-cpython/src/utils.rs
branchstable
changeset 52185 e698e3e75420
parent 52046 de317a87ea6a
child 52213 96b113d22b34
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(