##// END OF EJS Templates
rust-dirstatemap: expand the wrapping code a bit...
marmoute -
r48307:f6f25ab6 default
parent child Browse files
Show More
@@ -112,23 +112,31 b' py_class!(pub class DirstateMap |py| {'
112 112 size: PyObject,
113 113 mtime: PyObject
114 114 ) -> PyResult<PyObject> {
115 self.inner(py).borrow_mut().add_file(
116 HgPath::new(f.extract::<PyBytes>(py)?.data(py)),
117 oldstate.extract::<PyBytes>(py)?.data(py)[0]
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]
118 123 .try_into()
119 124 .map_err(|e: HgError| {
120 125 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 },
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 };
136 self.inner(py).borrow_mut().add_file(
137 filename,
138 oldstate,
139 entry,
132 140 ).and(Ok(py.None())).or_else(|e: DirstateError| {
133 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