[PATCH 3 of 3 RFC] revset: add an 'all' argument to ancestor() to return

Yuya Nishihara yuya at tcha.org
Mon May 28 08:27:40 EDT 2018


On Sun, 27 May 2018 13:48:18 +0200, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean at farley.io>
> # Date 1527357855 -7200
> #      Sat May 26 20:04:15 2018 +0200
> # Node ID 9fa3f81f4685ca73393f57253f2f05a0d758c022
> # Parent  000e9442997b1c61ae02a27e657ffb34d170502b
> # EXP-Topic gca-revset
> revset: add an 'all' argument to ancestor() to return
> 
> Currently, I'm not sure if this should be an option or a new revset
> method.

Maybe this can be an optimized path for 'heads(::x, ::y)'?
commonancestorsheads() is documented as such.

> +    args = getargsdict(x, 'ancestor', 'set all')

'*set all' because it takes a variable number of arguments.

> +        if allcommon and len(revs) > 1:
> +            # for now error if more than two
> +            if len(revs) > 2:
> +                msg = _("currently returning all greatest common ancestors "
> +                        "only works two revs")
> +                raise error.Abort(msg)
> +            return repo[revs.first()].commonancestors(repo[revs.last()])

Missed 'subset &' filtering.


More information about the Mercurial-devel mailing list