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

Yuya Nishihara yuya at tcha.org
Tue May 29 07:34:56 EDT 2018


On Mon, 28 May 2018 19:24:08 -0700, Sean Farley wrote:
> > On Mon, 28 May 2018 21:27:40 +0900, Yuya Nishihara wrote:
> >> 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.
> >
> > To be clear, I thought this should be a new revset function since 'all' could
> > also mean "all ancestors." And I noticed that it could be a private function
> > '_ancestorheads(x, y)' rewritten from 'heads(::x, ::y)'.
> 
> Yeah, I think I agree that it should be a new revset; thanks. I'm not
> quite sure what optimization you mean for heads(::x, ::y), though?

My point is the proposed function can be expressed as a combination of
existing functions:

  'heads(::x, ::y)'  (when 'x' and 'y' have at most one element each)

so we wouldn't have to add new public function.

That said, it isn't easy to determine if 'heads(::x, ::y)' can be rewritten
to '_commonancestorsheads(x, y)' while parsing because 'x'/'y' may return
more than one revisions. So we'll probably end up adding new function,
'heads(commonancestors(set))' or 'commonancestorsheads(set)'.


More information about the Mercurial-devel mailing list