837 .expect("head revs should be cached") |
837 .expect("head revs should be cached") |
838 .clone_ref(py) |
838 .clone_ref(py) |
839 .into_object()) |
839 .into_object()) |
840 } |
840 } |
841 |
841 |
|
842 fn inner_headrevsfiltered( |
|
843 &self, |
|
844 py: Python, |
|
845 filtered_revs: &PyObject, |
|
846 ) -> PyResult<PyObject> { |
|
847 let index = &*self.index(py).borrow(); |
|
848 let filtered_revs = rev_pyiter_collect(py, filtered_revs, index)?; |
|
849 |
|
850 if let Some(new_heads) = index |
|
851 .head_revs_filtered(&filtered_revs, true) |
|
852 .map_err(|e| graph_error(py, e))? |
|
853 { |
|
854 self.cache_new_heads_py_list(&new_heads, py); |
|
855 } |
|
856 |
|
857 Ok(self |
|
858 .head_revs_py_list(py) |
|
859 .borrow() |
|
860 .as_ref() |
|
861 .expect("head revs should be cached") |
|
862 .clone_ref(py) |
|
863 .into_object()) |
|
864 } |
|
865 |
842 fn check_revision( |
866 fn check_revision( |
843 index: &hg::index::Index, |
867 index: &hg::index::Index, |
844 rev: UncheckedRevision, |
868 rev: UncheckedRevision, |
845 py: Python, |
869 py: Python, |
846 ) -> PyResult<Revision> { |
870 ) -> PyResult<Revision> { |
867 let removed: Vec<_> = |
891 let removed: Vec<_> = |
868 removed.into_iter().map(PyRevision::from).collect(); |
892 removed.into_iter().map(PyRevision::from).collect(); |
869 let added: Vec<_> = added.into_iter().map(PyRevision::from).collect(); |
893 let added: Vec<_> = added.into_iter().map(PyRevision::from).collect(); |
870 let res = (removed, added).to_py_object(py).into_object(); |
894 let res = (removed, added).to_py_object(py).into_object(); |
871 Ok(res) |
895 Ok(res) |
872 } |
|
873 |
|
874 fn inner_headrevsfiltered( |
|
875 &self, |
|
876 py: Python, |
|
877 filtered_revs: &PyObject, |
|
878 ) -> PyResult<PyObject> { |
|
879 let index = &*self.index(py).borrow(); |
|
880 let filtered_revs = rev_pyiter_collect(py, filtered_revs, index)?; |
|
881 |
|
882 if let Some(new_heads) = index |
|
883 .head_revs_filtered(&filtered_revs, true) |
|
884 .map_err(|e| graph_error(py, e))? |
|
885 { |
|
886 self.cache_new_heads_py_list(&new_heads, py); |
|
887 } |
|
888 |
|
889 Ok(self |
|
890 .head_revs_py_list(py) |
|
891 .borrow() |
|
892 .as_ref() |
|
893 .expect("head revs should be cached") |
|
894 .clone_ref(py) |
|
895 .into_object()) |
|
896 } |
896 } |
897 |
897 |
898 fn cache_new_heads_node_ids_py_list( |
898 fn cache_new_heads_node_ids_py_list( |
899 &self, |
899 &self, |
900 new_heads: &[Revision], |
900 new_heads: &[Revision], |