comparison 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
comparison
equal deleted inserted replaced
49105:a69ea5a3c5a5 49106:c1a3fdedc492
156 let bytes = f.extract::<PyBytes>(py)?; 156 let bytes = f.extract::<PyBytes>(py)?;
157 let path = HgPath::new(bytes.data(py)); 157 let path = HgPath::new(bytes.data(py));
158 let res = self.inner(py).borrow_mut().set_clean( 158 let res = self.inner(py).borrow_mut().set_clean(
159 path, mode, size, timestamp, 159 path, mode, size, timestamp,
160 ); 160 );
161 res.or_else(|_| {
162 Err(PyErr::new::<exc::OSError, _>(py, "Dirstate error".to_string()))
163 })?;
164 Ok(PyNone)
165 }
166
167 def set_possibly_dirty(&self, f: PyObject) -> PyResult<PyNone> {
168 let bytes = f.extract::<PyBytes>(py)?;
169 let path = HgPath::new(bytes.data(py));
170 let res = self.inner(py).borrow_mut().set_possibly_dirty(path);
161 res.or_else(|_| { 171 res.or_else(|_| {
162 Err(PyErr::new::<exc::OSError, _>(py, "Dirstate error".to_string())) 172 Err(PyErr::new::<exc::OSError, _>(py, "Dirstate error".to_string()))
163 })?; 173 })?;
164 Ok(PyNone) 174 Ok(PyNone)
165 } 175 }