Show More
@@ -116,6 +116,16 b' impl PartialDiscovery {' | |||||
116 | ) |
|
116 | ) | |
117 | } |
|
117 | } | |
118 |
|
118 | |||
|
119 | /// Convert a Python iterator of revisions into a vector | |||
|
120 | fn pyiter_to_vec( | |||
|
121 | &self, | |||
|
122 | py: Python, | |||
|
123 | iter: &PyObject, | |||
|
124 | ) -> PyResult<Vec<Revision>> { | |||
|
125 | let index = self.index(py).borrow(); | |||
|
126 | rev_pyiter_collect(py, iter, &*index) | |||
|
127 | } | |||
|
128 | ||||
119 | fn inner_addinfo( |
|
129 | fn inner_addinfo( | |
120 | &self, |
|
130 | &self, | |
121 | py: Python, |
|
131 | py: Python, | |
@@ -152,8 +162,7 b' impl PartialDiscovery {' | |||||
152 | py: Python, |
|
162 | py: Python, | |
153 | commons: PyObject, |
|
163 | commons: PyObject, | |
154 | ) -> PyResult<PyObject> { |
|
164 | ) -> PyResult<PyObject> { | |
155 | let index = self.index(py).borrow(); |
|
165 | let commons_vec = self.pyiter_to_vec(py, &commons)?; | |
156 | let commons_vec: Vec<_> = rev_pyiter_collect(py, &commons, &*index)?; |
|
|||
157 | let mut inner = self.inner(py).borrow_mut(); |
|
166 | let mut inner = self.inner(py).borrow_mut(); | |
158 | inner |
|
167 | inner | |
159 | .add_common_revisions(commons_vec) |
|
168 | .add_common_revisions(commons_vec) | |
@@ -166,8 +175,7 b' impl PartialDiscovery {' | |||||
166 | py: Python, |
|
175 | py: Python, | |
167 | missings: PyObject, |
|
176 | missings: PyObject, | |
168 | ) -> PyResult<PyObject> { |
|
177 | ) -> PyResult<PyObject> { | |
169 | let index = self.index(py).borrow(); |
|
178 | let missings_vec = self.pyiter_to_vec(py, &missings)?; | |
170 | let missings_vec: Vec<_> = rev_pyiter_collect(py, &missings, &*index)?; |
|
|||
171 | let mut inner = self.inner(py).borrow_mut(); |
|
179 | let mut inner = self.inner(py).borrow_mut(); | |
172 | inner |
|
180 | inner | |
173 | .add_missing_revisions(missings_vec) |
|
181 | .add_missing_revisions(missings_vec) | |
@@ -198,9 +206,8 b' impl PartialDiscovery {' | |||||
198 | headrevs: PyObject, |
|
206 | headrevs: PyObject, | |
199 | size: usize, |
|
207 | size: usize, | |
200 | ) -> PyResult<PyObject> { |
|
208 | ) -> PyResult<PyObject> { | |
201 | let index = self.index(py).borrow(); |
|
209 | let revsvec = self.pyiter_to_vec(py, &headrevs)?; | |
202 | let mut inner = self.inner(py).borrow_mut(); |
|
210 | let mut inner = self.inner(py).borrow_mut(); | |
203 | let revsvec: Vec<_> = rev_pyiter_collect(py, &headrevs, &*index)?; |
|
|||
204 | let sample = inner |
|
211 | let sample = inner | |
205 | .take_quick_sample(revsvec, size) |
|
212 | .take_quick_sample(revsvec, size) | |
206 | .map_err(|e| GraphError::pynew(py, e))?; |
|
213 | .map_err(|e| GraphError::pynew(py, e))?; |
General Comments 0
You need to be logged in to leave comments.
Login now