[PATCH 4 of 5 V3] rust: hooking into Python code

Yuya Nishihara yuya at tcha.org
Sun Oct 14 02:13:58 EDT 2018


On Sat, 13 Oct 2018 15:59:42 +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 98f0f668f63b143eba344a74c8b22a0588f46935
> # Parent  b1d2b4a4684a51ba9bfc3ea5bc6e177be65e4b69
> # EXP-Topic rustancestors-contains
> rust: hooking into Python code

> +    def ancestors(self, revs, *args, **kwargs):
> +        if util.safehasattr(parsers, 'rustlazyancestors') and self.filteredrevs:
> +            missing = self.filteredrevs.difference(revs)
> +            if missing:
> +                # raise the lookup error
> +                self.rev(min(missing))
> +        return super(changelog, self).ancestors(revs, *args, **kwargs)
> +
>      def reachableroots(self, minroot, heads, roots, includepath=False):
>          return self.index.reachableroots2(minroot, heads, roots, includepath)
>  
> diff -r b1d2b4a4684a -r 98f0f668f63b 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)

This can't apply probably because of my change, adbf8ca239e4 "revlog: optimize
ancestors() to not check filtered revisions for each."

Can you send V4 with updated benchmark results?


More information about the Mercurial-devel mailing list