Mercurial > hg
diff rust/hg-cpython/src/dirstate/dirstate_map.rs @ 47121:b6339a993b91
rust: Remove handling of `parents` in `DirstateMap`
The Python wrapper class `dirstatemap` can take care of it.
This removes the need to have both `_rustmap` and `_inner_rustmap`.
Differential Revision: https://phab.mercurial-scm.org/D10555
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Fri, 30 Apr 2021 15:40:11 +0200 |
parents | d5956136d19d |
children | 9aba0cde0ed9 |
line wrap: on
line diff
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs Fri Apr 30 14:22:14 2021 +0200 +++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs Fri Apr 30 15:40:11 2021 +0200 @@ -13,8 +13,8 @@ use cpython::{ exc, ObjectProtocol, PyBool, PyBytes, PyClone, PyDict, PyErr, PyList, - PyObject, PyResult, PySet, PyString, PyTuple, Python, PythonObject, - ToPyObject, UnsafePyLeaked, + PyObject, PyResult, PySet, PyString, Python, PythonObject, ToPyObject, + UnsafePyLeaked, }; use crate::{ @@ -271,27 +271,6 @@ .to_py_object(py)) } - def parents(&self, st: PyObject) -> PyResult<PyTuple> { - self.inner(py).borrow_mut() - .parents(st.extract::<PyBytes>(py)?.data(py)) - .map(|parents| dirstate_parents_to_pytuple(py, parents)) - .or_else(|_| { - Err(PyErr::new::<exc::OSError, _>( - py, - "Dirstate error".to_string(), - )) - }) - } - - def setparents(&self, p1: PyObject, p2: PyObject) -> PyResult<PyObject> { - let p1 = extract_node_id(py, &p1)?; - let p2 = extract_node_id(py, &p2)?; - - self.inner(py).borrow_mut() - .set_parents(&DirstateParents { p1, p2 }); - Ok(py.None()) - } - def read(&self, st: PyObject) -> PyResult<Option<PyObject>> { match self.inner(py).borrow_mut() .read(st.extract::<PyBytes>(py)?.data(py))