Mercurial > hg
comparison rust/hg-cpython/src/dirstate/dirstate_map.rs @ 49104:b5c2aca84618
rust-dirstatemap: add `set_clean` method
This is the new dirstate API that has already been moved to in Python.
Differential Revision: https://phab.mercurial-scm.org/D12502
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Mon, 28 Mar 2022 18:02:50 +0200 |
parents | dd0430434ce9 |
children | c1a3fdedc492 |
comparison
equal
deleted
inserted
replaced
49103:77dfde417e5e | 49104:b5c2aca84618 |
---|---|
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(|_| { | 139 let was_tracked = res.or_else(|_| { |
140 Err(PyErr::new::<exc::OSError, _>(py, "Dirstate error".to_string())) | 140 Err(PyErr::new::<exc::OSError, _>(py, "Dirstate error".to_string())) |
141 })?; | 141 })?; |
142 Ok(was_tracked.to_py_object(py)) | 142 Ok(was_tracked.to_py_object(py)) |
143 } | |
144 | |
145 def set_clean( | |
146 &self, | |
147 f: PyObject, | |
148 mode: u32, | |
149 size: u32, | |
150 mtime: (i64, u32, bool) | |
151 ) -> PyResult<PyNone> { | |
152 let (mtime_s, mtime_ns, second_ambiguous) = mtime; | |
153 let timestamp = TruncatedTimestamp::new_truncate( | |
154 mtime_s, mtime_ns, second_ambiguous | |
155 ); | |
156 let bytes = f.extract::<PyBytes>(py)?; | |
157 let path = HgPath::new(bytes.data(py)); | |
158 let res = self.inner(py).borrow_mut().set_clean( | |
159 path, mode, size, timestamp, | |
160 ); | |
161 res.or_else(|_| { | |
162 Err(PyErr::new::<exc::OSError, _>(py, "Dirstate error".to_string())) | |
163 })?; | |
164 Ok(PyNone) | |
143 } | 165 } |
144 | 166 |
145 def reset_state( | 167 def reset_state( |
146 &self, | 168 &self, |
147 f: PyObject, | 169 f: PyObject, |