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:

jj/lib/src/revset.rs

Lines 946 to 950 in b19bf37

map.insert("ancestors", |name, arguments_pair, state| {
let arg = expect_one_argument(name, arguments_pair)?;
let expression = parse_expression_rule(arg.into_inner(), state)?;
Ok(expression.ancestors())
});

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…

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

@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