comparison rust/hg-cpython/src/dirstate/dirstate_map.rs @ 49108:119c7e2b4248

rust-dirstatemap: add `set_untracked` method This is the new API that Python has already migrated to Differential Revision: https://phab.mercurial-scm.org/D12506
author Raphaël Gomès <rgomes@octobus.net>
date Mon, 28 Mar 2022 18:13:58 +0200
parents c1a3fdedc492
children 8a17fc501eda
comparison
equal deleted inserted replaced
49107:079aaf996eca 49108:119c7e2b4248
134 134
135 def set_tracked(&self, f: PyObject) -> PyResult<PyBool> { 135 def set_tracked(&self, f: PyObject) -> PyResult<PyBool> {
136 let bytes = f.extract::<PyBytes>(py)?; 136 let bytes = f.extract::<PyBytes>(py)?;
137 let path = HgPath::new(bytes.data(py)); 137 let path = HgPath::new(bytes.data(py));
138 let res = self.inner(py).borrow_mut().set_tracked(path); 138 let res = self.inner(py).borrow_mut().set_tracked(path);
139 let was_tracked = res.or_else(|_| {
140 Err(PyErr::new::<exc::OSError, _>(py, "Dirstate error".to_string()))
141 })?;
142 Ok(was_tracked.to_py_object(py))
143 }
144
145 def set_untracked(&self, f: PyObject) -> PyResult<PyBool> {
146 let bytes = f.extract::<PyBytes>(py)?;
147 let path = HgPath::new(bytes.data(py));
148 let res = self.inner(py).borrow_mut().set_untracked(path);
139 let was_tracked = res.or_else(|_| { 149 let was_tracked = res.or_else(|_| {
140 Err(PyErr::new::<exc::OSError, _>(py, "Dirstate error".to_string())) 150 Err(PyErr::new::<exc::OSError, _>(py, "Dirstate error".to_string()))
141 })?; 151 })?;
142 Ok(was_tracked.to_py_object(py)) 152 Ok(was_tracked.to_py_object(py))
143 } 153 }