-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
revset: add coalesce(revsets...)
#4628
Conversation
7c88796
to
cf084dc
Compare
cf084dc
to
4d6f75c
Compare
if(condition, consequent[, alternate = none()]
if_not_none
and coalesce
functions
4d6f75c
to
a80b5a5
Compare
I've updated to add a |
a80b5a5
to
c8fefec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not very familiar with the revset engine for now, so I'm not sure if I should attempt to create an
InternalRevset
for these two functions versus evaluating it in theevaluate
function.
I think the current implementation is good. We could add InternalRevset
to make iteration lazy, but it doesn't mean the evaluation can always be lazy. For example, coalesce(foo, heads(bar))
would have to "evaluate" bar
because heads(candidates)
evaluates candidates
eagerly. With the current implementation, heads(bar)
evaluation can be skipped if foo
is not empty.
c8fefec
to
1a8f649
Compare
Updated the PR to remove |
if_not_none
and coalesce
functionscoalesce(revsets...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
6bf1386
to
9046c5c
Compare
The `coalesce` function takes a list of revsets and returns the commits in the first revset in the list which evalutes to a non-empty set of commits. It can be used to display fallbacks if a certain commit cannot be found, e.g. `coalesce(present(user_configured_trunk), builtin_trunk)`.
9046c5c
to
3f6814a
Compare
Checklist
If applicable:
CHANGELOG.md