Show More
@@ -112,23 +112,31 b' py_class!(pub class DirstateMap |py| {' | |||||
112 | size: PyObject, |
|
112 | size: PyObject, | |
113 | mtime: PyObject |
|
113 | mtime: PyObject | |
114 | ) -> PyResult<PyObject> { |
|
114 | ) -> PyResult<PyObject> { | |
|
115 | let f = f.extract::<PyBytes>(py)?; | |||
|
116 | let filename = HgPath::new(f.data(py)); | |||
|
117 | let oldstate = oldstate.extract::<PyBytes>(py)?.data(py)[0] | |||
|
118 | .try_into() | |||
|
119 | .map_err(|e: HgError| { | |||
|
120 | PyErr::new::<exc::ValueError, _>(py, e.to_string()) | |||
|
121 | })?; | |||
|
122 | let state = state.extract::<PyBytes>(py)?.data(py)[0] | |||
|
123 | .try_into() | |||
|
124 | .map_err(|e: HgError| { | |||
|
125 | PyErr::new::<exc::ValueError, _>(py, e.to_string()) | |||
|
126 | })?; | |||
|
127 | let mode = mode.extract(py)?; | |||
|
128 | let size = size.extract(py)?; | |||
|
129 | let mtime = mtime.extract(py)?; | |||
|
130 | let entry = DirstateEntry { | |||
|
131 | state: state, | |||
|
132 | mode: mode, | |||
|
133 | size: size, | |||
|
134 | mtime: mtime, | |||
|
135 | }; | |||
115 | self.inner(py).borrow_mut().add_file( |
|
136 | self.inner(py).borrow_mut().add_file( | |
116 | HgPath::new(f.extract::<PyBytes>(py)?.data(py)), |
|
137 | filename, | |
117 | oldstate.extract::<PyBytes>(py)?.data(py)[0] |
|
138 | oldstate, | |
118 |
|
|
139 | entry, | |
119 | .map_err(|e: HgError| { |
|
|||
120 | PyErr::new::<exc::ValueError, _>(py, e.to_string()) |
|
|||
121 | })?, |
|
|||
122 | DirstateEntry { |
|
|||
123 | state: state.extract::<PyBytes>(py)?.data(py)[0] |
|
|||
124 | .try_into() |
|
|||
125 | .map_err(|e: HgError| { |
|
|||
126 | PyErr::new::<exc::ValueError, _>(py, e.to_string()) |
|
|||
127 | })?, |
|
|||
128 | mode: mode.extract(py)?, |
|
|||
129 | size: size.extract(py)?, |
|
|||
130 | mtime: mtime.extract(py)?, |
|
|||
131 | }, |
|
|||
132 | ).and(Ok(py.None())).or_else(|e: DirstateError| { |
|
140 | ).and(Ok(py.None())).or_else(|e: DirstateError| { | |
133 | Err(PyErr::new::<exc::ValueError, _>(py, e.to_string())) |
|
141 | Err(PyErr::new::<exc::ValueError, _>(py, e.to_string())) | |
134 | }) |
|
142 | }) |
General Comments 0
You need to be logged in to leave comments.
Login now