Show More
@@ -43,7 +43,6 b' fn reviter_to_revvec(py: Python, revs: P' | |||||
43 | } |
|
43 | } | |
44 |
|
44 | |||
45 | py_class!(pub class AncestorsIterator |py| { |
|
45 | py_class!(pub class AncestorsIterator |py| { | |
46 | // TODO RW lock ? |
|
|||
47 | data inner: RefCell<Box<CoreIterator<Index>>>; |
|
46 | data inner: RefCell<Box<CoreIterator<Index>>>; | |
48 |
|
47 | |||
49 | def __next__(&self) -> PyResult<Option<Revision>> { |
|
48 | def __next__(&self) -> PyResult<Option<Revision>> { | |
@@ -55,7 +54,8 b' py_class!(pub class AncestorsIterator |p' | |||||
55 | } |
|
54 | } | |
56 |
|
55 | |||
57 | def __contains__(&self, rev: Revision) -> PyResult<bool> { |
|
56 | def __contains__(&self, rev: Revision) -> PyResult<bool> { | |
58 |
self.inner(py).borrow_mut().contains(rev) |
|
57 | self.inner(py).borrow_mut().contains(rev) | |
|
58 | .map_err(|e| GraphError::pynew(py, e)) | |||
59 | } |
|
59 | } | |
60 |
|
60 | |||
61 | def __iter__(&self) -> PyResult<Self> { |
|
61 | def __iter__(&self) -> PyResult<Self> { | |
@@ -65,14 +65,13 b' py_class!(pub class AncestorsIterator |p' | |||||
65 | def __new__(_cls, index: PyObject, initrevs: PyObject, stoprev: Revision, |
|
65 | def __new__(_cls, index: PyObject, initrevs: PyObject, stoprev: Revision, | |
66 | inclusive: bool) -> PyResult<AncestorsIterator> { |
|
66 | inclusive: bool) -> PyResult<AncestorsIterator> { | |
67 | let initvec = reviter_to_revvec(py, initrevs)?; |
|
67 | let initvec = reviter_to_revvec(py, initrevs)?; | |
68 |
let ait = |
|
68 | let ait = CoreIterator::new( | |
69 | initvec, stoprev, |
|
69 | Index::new(py, index)?, | |
70 | inclusive) { |
|
70 | initvec, | |
71 | Ok(ait) => ait, |
|
71 | stoprev, | |
72 | Err(e) => { |
|
72 | inclusive, | |
73 | return Err(GraphError::pynew(py, e)); |
|
73 | ) | |
74 | } |
|
74 | .map_err(|e| GraphError::pynew(py, e))?; | |
75 | }; |
|
|||
76 | AncestorsIterator::from_inner(py, ait) |
|
75 | AncestorsIterator::from_inner(py, ait) | |
77 | } |
|
76 | } | |
78 |
|
77 |
General Comments 0
You need to be logged in to leave comments.
Login now