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: Add a language for selecting a tree #5307

Open
martinvonz opened this issue Jan 9, 2025 · 1 comment
Open

FR: Add a language for selecting a tree #5307

martinvonz opened this issue Jan 9, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@martinvonz
Copy link
Member

Is your feature request related to a problem? Please describe.

It's always bothered me that jj diff -r X cannot be written as jj diff --to X --from <something> because X- might resolve to multiple revisions. There are other such examples like in jj restore.

A related to case that came up on Discord was that jj restore could be used for resolving a conflict in favor of a particular side of the conflict if we had a way of selecting a given tree from a conflict.

Describe the solution you'd like

Commands that currently take a revision argument only to resolve it to a tree (e.g. jj diff --from/--to, jj restore --from, jj file show -r) could take a new kind of expression instead of a revset. The new expression would allow regular revset but will resolve to a tree instead. By default, the revset is expected to resolve to a single revision and we use that revision's tree (merged if a conflict). But the user can also do something like jj diff --from 'merge_of(X-)' --to Y to merge the commits inX-, or jj restore --from 'conflict_side(X, 1)'.

Describe alternatives you've considered

We've talked about making revsets themselves able to calculate merges of commits. I don't like that idea because it complicates revsets, and it means that the merged result would presumably be assigned to a commit (with some placeholder description etc) to fit into the revset language.

@arxanas
Copy link
Contributor

arxanas commented Jan 9, 2025

A related to case that came up on Discord was that jj restore could be used for resolving a conflict in favor of a particular side of the conflict if we had a way of selecting a given tree from a conflict.

Link to the Discord question thread: "Resolve conflict by picking a side for all".

@PhilipMetzger PhilipMetzger added the enhancement New feature or request label Jan 9, 2025
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