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