Skip to content
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

FR: 'default()' revset function for the configured default revset #4554

Open
BatmanAoD opened this issue Sep 30, 2024 · 1 comment
Open

FR: 'default()' revset function for the configured default revset #4554

BatmanAoD opened this issue Sep 30, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@BatmanAoD
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
Currently, if you use -r or include a path argument with log, your configured revsets.log entry is completely ignored, and you must ensure that your use of -r is a complete description of the revset you'd like to see.

This makes sense, because -r should be unambiguous (...though it currently isn't; see my comment here). But if someone has taken the trouble to configure revsets.log, especially if it's a complex expression, it would be helpful to be able to use variations of that default revset without needing to rewrite it as part of each command's revset expression.

Describe the solution you'd like
There should be a new function in the revset language, named something like default() or configured(), that expands to the configured revsets.log.

One advantage of configured() over default() is that default() could instead expand to the pre-configuration default, i.e. '@ | ancestors(immutable_heads().., 2) | trunk()'.

Describe alternatives you've considered
The actual config entry path could be used: revsets.log(). That feels a little weird to me, since presumably we wouldn't want arbitrary config paths to be part of the revset language. However, maybe that would make sense if the revsets block is expanded to include entries other than log and short-prefixes.

One alternative that I think would be strictly worse would be a separate flag that would have the same behavior as adding & <expr> to the revset, where <expr> is the configured revset expression.

Additional context
See links above.

@PhilipMetzger PhilipMetzger added the enhancement New feature or request label Sep 30, 2024
@yuja
Copy link
Collaborator

yuja commented Sep 30, 2024

It could be some namespaced aliases (e.g. revsets.log = {'default()': .., 'work()': ..}), but I'm not sure. (I just thought the single default() might not be enough if we expand this rule to -T/--template arguments.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants