[PATCH 4 of 6 V2] rust: hooking into Python code

Yuya Nishihara yuya at tcha.org
Fri Oct 12 06:19:30 EDT 2018


On Fri, 12 Oct 2018 11:39:18 +0200, Georges Racinet wrote:
> On 10/12/2018 07:03 AM, Yuya Nishihara wrote:
> > On Tue, 09 Oct 2018 17:22:48 +0200, Georges Racinet wrote:
> >> # HG changeset patch
> >> # User Georges Racinet <gracinet at anybox.fr>
> >> # Date 1538060144 -7200
> >> #      Thu Sep 27 16:55:44 2018 +0200
> >> # Node ID 210cd79d35d50e989a7eabbcebb4addde9365f9e
> >> # Parent  cf5c799e65a1225538fa1246887e2efd94c09acc
> >> # EXP-Topic rustancestors-rfc
> >> rust: hooking into Python code

> >> diff -r cf5c799e65a1 -r 210cd79d35d5 mercurial/revlog.py
> >> --- a/mercurial/revlog.py	Thu Sep 27 16:56:15 2018 +0200
> >> +++ b/mercurial/revlog.py	Thu Sep 27 16:55:44 2018 +0200
> >> @@ -747,6 +747,10 @@
> >>  
> >>          See the documentation for ancestor.lazyancestors for more details."""
> >>  
> >> +        if util.safehasattr(parsers, 'rustlazyancestors'):
> >> +            return ancestor.rustlazyancestors(
> >> +                self.index, revs,
> >> +                stoprev=stoprev, inclusive=inclusive)
> >>          return ancestor.lazyancestors(self.parentrevs, revs, stoprev=stoprev,
> >>                                        inclusive=inclusive)
> > I think these "if WITH_RUST" things can be handled in ancestors.py.
> The reason was that ancestor.lazyancestors is initialized from the
> parents function, whereas the Rust bascked implementation needs the
> index.  I'd be glad to push that down to ancestors.py and harmonize over
> passing the index, but that's a bigger change.

Ah, good point. The factory function could be moved to ancestors.py, but that
wouldn't make sense given we'll have to pass in a revlog instance to it.


More information about the Mercurial-devel mailing list