D5550: rust-cpython: bindings for MissingAncestors
Georges Racinet
georges.racinet at octobus.net
Fri Jan 11 09:16:42 EST 2019
On 1/11/19 3:10 PM, yuja (Yuya Nishihara) wrote:
> yuja added a comment.
>
>
> Queued up to this patch, thanks.
Great, thanks !
>
> > + def __new__(_cls, index: PyObject, bases: PyObject) -> PyResult<MissingAncestors> {
> > + let bases_vec: Vec<Revision> = rev_pyiter_collect(py, &bases)?;
> > + let inner = CoreMissing::new(Index::new(py, index)?, bases_vec);
>
> We might want to directly build `HashSet<Revision>` here if that matters.
>
> > + def missingancestors(&self, revs: PyObject) -> PyResult<PyList> {
> > + let mut inner = self.inner(py).borrow_mut();
> > + let revs_vec: Vec<Revision> = rev_pyiter_collect(py, &revs)?;
> > + let missing_vec = match inner.missing_ancestors(revs_vec) {
> > + Ok(missing) => missing,
> > + Err(e) => {
> > + return Err(GraphError::pynew(py, e));
> > + }
> > + };
>
>
>
> > + // convert as Python list
> > + let mut missing_pyint_vec: Vec<PyObject> = Vec::with_capacity(
> > + missing_vec.len());
> > + for rev in missing_vec {
> > + missing_pyint_vec.push(rev.to_py_object(py).into_object());
> > + }
> > + Ok(PyList::new(py, missing_pyint_vec.as_slice()))
>
> Maybe this can be extracted to a helper function so that we can `.map()`
> the result.
>
> REPOSITORY
> rHG Mercurial
>
> REVISION DETAIL
> https://phab.mercurial-scm.org/D5550
>
> To: gracinet, #hg-reviewers
> Cc: yuja, durin42, kevincox, mercurial-devel
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
--
Georges Racinet
https://octobus.net
GPG: BF5456F4DC625443849B6E58EE20CA44EF691D39, sur serveurs publics
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20190111/61645424/attachment.sig>
More information about the Mercurial-devel
mailing list