comparison rust/hg-cpython/src/dirstate/dirstate_map.rs @ 47524:69a463a4f193

dirstate: no longer pass the `oldstate` value to the dirstatemap The dirstatemap already have this information. Differential Revision: https://phab.mercurial-scm.org/D10966
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 03 Jul 2021 20:59:26 +0200
parents abed645b8e96
children fe4641cf9b72
comparison
equal deleted inserted replaced
47523:b76d54b90dc9 47524:69a463a4f193
106 } 106 }
107 107
108 def addfile( 108 def addfile(
109 &self, 109 &self,
110 f: PyObject, 110 f: PyObject,
111 oldstate: PyObject,
112 state: PyObject, 111 state: PyObject,
113 mode: PyObject, 112 mode: PyObject,
114 size: PyObject, 113 size: PyObject,
115 mtime: PyObject, 114 mtime: PyObject,
116 from_p2: PyObject, 115 from_p2: PyObject,
117 possibly_dirty: PyObject, 116 possibly_dirty: PyObject,
118 ) -> PyResult<PyObject> { 117 ) -> PyResult<PyObject> {
119 let f = f.extract::<PyBytes>(py)?; 118 let f = f.extract::<PyBytes>(py)?;
120 let filename = HgPath::new(f.data(py)); 119 let filename = HgPath::new(f.data(py));
121 let oldstate = oldstate.extract::<PyBytes>(py)?.data(py)[0]
122 .try_into()
123 .map_err(|e: HgError| {
124 PyErr::new::<exc::ValueError, _>(py, e.to_string())
125 })?;
126 let state = state.extract::<PyBytes>(py)?.data(py)[0] 120 let state = state.extract::<PyBytes>(py)?.data(py)[0]
127 .try_into() 121 .try_into()
128 .map_err(|e: HgError| { 122 .map_err(|e: HgError| {
129 PyErr::new::<exc::ValueError, _>(py, e.to_string()) 123 PyErr::new::<exc::ValueError, _>(py, e.to_string())
130 })?; 124 })?;
149 }; 143 };
150 let from_p2 = from_p2.extract::<PyBool>(py)?.is_true(); 144 let from_p2 = from_p2.extract::<PyBool>(py)?.is_true();
151 let possibly_dirty = possibly_dirty.extract::<PyBool>(py)?.is_true(); 145 let possibly_dirty = possibly_dirty.extract::<PyBool>(py)?.is_true();
152 self.inner(py).borrow_mut().add_file( 146 self.inner(py).borrow_mut().add_file(
153 filename, 147 filename,
154 oldstate,
155 entry, 148 entry,
156 from_p2, 149 from_p2,
157 possibly_dirty 150 possibly_dirty
158 ).and(Ok(py.None())).or_else(|e: DirstateError| { 151 ).and(Ok(py.None())).or_else(|e: DirstateError| {
159 Err(PyErr::new::<exc::ValueError, _>(py, e.to_string())) 152 Err(PyErr::new::<exc::ValueError, _>(py, e.to_string()))