Mercurial > public > mercurial-scm > hg
diff rust/hg-cpython/src/dirstate/dirstate_map.rs @ 49106:c1a3fdedc492
rust-dirstatemap: add `set_possibly_dirty` method
This is the new API that Python has already migrated to.
Differential Revision: https://phab.mercurial-scm.org/D12504
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Mon, 28 Mar 2022 18:09:01 +0200 |
parents | b5c2aca84618 |
children | 119c7e2b4248 |
line wrap: on
line diff
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs Mon Mar 28 18:02:45 2022 +0200 +++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs Mon Mar 28 18:09:01 2022 +0200 @@ -164,6 +164,16 @@ Ok(PyNone) } + def set_possibly_dirty(&self, f: PyObject) -> PyResult<PyNone> { + let bytes = f.extract::<PyBytes>(py)?; + let path = HgPath::new(bytes.data(py)); + let res = self.inner(py).borrow_mut().set_possibly_dirty(path); + res.or_else(|_| { + Err(PyErr::new::<exc::OSError, _>(py, "Dirstate error".to_string())) + })?; + Ok(PyNone) + } + def reset_state( &self, f: PyObject,