Skip to content

How to get last n ancestors as revset #1984

Answered by martinvonz
sullyj3 asked this question in Q&A
Discussion options

You must be logged in to vote

The revset engine already knows how to do it, so I think it's just a matter of updating the ancestors() function to accept a generation range (@yuja can correct me if I'm wrong). That code is here: https://github.com/martinvonz/jj/blob/b19bf3757fe816da4f6079e388c8f9abb34ae214/lib/src/revset.rs#L946-L950

I'm not sure exactly what the syntax should be. Mercurial has ancestors(x, n) to give up to n generations up to the specified distance. I think it makes sense to copy that. We could also accept ancestors(x, m, n) to also allow a lower bound on the number of generation (i.e. making ancestors(x, n) equal to ancestors(x, 0, n)).

There's also support in the revset engine for descendants in a s…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@sullyj3
Comment options

sullyj3 Aug 5, 2023
Collaborator Author

@yuja
Comment options

yuja Aug 5, 2023
Collaborator

@sullyj3
Comment options

sullyj3 Sep 2, 2023
Collaborator Author

Answer selected by sullyj3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants