How to get last n ancestors as revset #1984
-
I'm trying to figure out how to do the equivalent of |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The revset engine already knows how to do it, so I think it's just a matter of updating the I'm not sure exactly what the syntax should be. Mercurial has There's also support in the revset engine for descendants in a specified range, so it shouldn't be hard to add syntax for that too. Do you feel like implementing any of that? |
Beta Was this translation helpful? Give feedback.
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-L950I'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 acceptancestors(x, m, n)
to also allow a lower bound on the number of generation (i.e. makingancestors(x, n)
equal toancestors(x, 0, n)
).There's also support in the revset engine for descendants in a s…