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: Print a hint of how to resolve conflicted branches or conflicted change ids #2192

Closed
ilyagr opened this issue Sep 1, 2023 · 8 comments
Closed
Assignees
Labels
good first issue Good for newcomers

Comments

@ilyagr
Copy link
Collaborator

ilyagr commented Sep 1, 2023

When a user has a conflicted branch, they usually run into a message like the following:

Error: Revset "deneb-produce-blockv3" resolved to more than one revision
Hint: The revset "deneb-produce-blockv3" resolved to these revisions:
179b3c05123f practical review :)
c79ed56ed347 config/params: Require placeholderFields to be sorted and distinct (#12834)

When a user has a conflicted change id, they run into a very similar message.

It would be nice if we did one or both of the following:

  1. jj informed the user when such conflicts are created (this could also apply to file conflicts)
  2. jj could automatically determine that it's in one of these situations when resolving a revset.

In either case, jj could then the appropriate advice (jj branch set for conflicted branches, jj abandon for conflicted change ids).

Related Discord discussions: 1, 2.

@james-prysm
Copy link

having some of these tips would be great!

@ilyagr ilyagr added the good first issue Good for newcomers label Sep 1, 2023
@wmrmrx
Copy link
Collaborator

wmrmrx commented Sep 2, 2023

Hi, could this issue be assigned to @isinyaaa and me (@wmrmrx)? We'll try looking at it!

@martinvonz
Copy link
Member

I could only assign it to you, @wmrmrx, probably because @isinyaaa hasn't said anything on this issue yet. @isinyaaa, can you add a comment so we can see if GitHub lets me assign it to you too after that?

@isinyaaa
Copy link
Collaborator

isinyaaa commented Sep 2, 2023

Here you go :) Thanks!

@martinvonz
Copy link
Member

It worked :)

@wmrmrx
Copy link
Collaborator

wmrmrx commented Sep 4, 2023

Hi, checking if the revset is a branch would be the way to go here?
https://github.com/martinvonz/jj/blob/e3c85d6ecc20ee4240cdf3ed80107ce7dc268abe/cli/src/cli_util.rs#L1018C4-L1018C4

if revset_is_branch {
    hint = ... // hint to use jj branch set/jj abandon
} else {
    hint = normal_hint
}

@martinvonz
Copy link
Member

Yes, that sounds right to me. You can inspect the revset_expression to see if it mentions any conflicted branches. It's probably good enough to check only if the expression is exactly RevsetExpression::CommitRef(RevsetCommitRef::Symbol(name)), where name is a conflicted branch.

@PhilipMetzger
Copy link
Collaborator

I'm going to close this issue as it has been adressed by #2244

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

6 participants