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

Implement #2475 #3410

Merged
merged 1 commit into from
Apr 3, 2024
Merged

Implement #2475 #3410

merged 1 commit into from
Apr 3, 2024

Conversation

noahmayr
Copy link
Collaborator

@noahmayr noahmayr commented Mar 31, 2024

Implementation for #2475

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

cli/src/commands/log.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@yuja yuja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding #2475, I think the default revset can be turned off if any path arguments are specified.

jj log            # use default revset
jj log -rREV      # REV
jj log PATH       # file(PATH)
jj log -rREV PATH # REV & file(PATH)

It implies that the PATH and REV arguments are basically the same things (with a bit different representations.) WDYT?

cli/src/commands/log.rs Outdated Show resolved Hide resolved
@joyously
Copy link

joyously commented Apr 1, 2024

Regarding # 2475, I think the default revset can be turned off if any path arguments are specified.

jj log            # use default revset
jj log -rREV      # REV
jj log PATH       # file(PATH)
jj log -rREV PATH # REV & file(PATH)

What is the special case? If I do

jj log -r 'author(yuya)'
jj log CHANGELOG.md
jj log -r 'author(yuya)' CHANGELOG.md

I should get 3 different results.

@yuja
Copy link
Collaborator

yuja commented Apr 1, 2024

jj log            # use default revset
jj log -rREV      # REV
jj log PATH       # file(PATH)
jj log -rREV PATH # REV & file(PATH)

What is the special case?

Special case exists only for jj log (without filtering options)?

The current definition is: -r defaults to revsets.log
So jj log PATH means jj log -r<revsets.log> PATH.

My proposal is: revsets.log is used only if no filtering options (-r or PATH) are specified.

@joyously
Copy link

joyously commented Apr 1, 2024

My proposal is: revsets.log is used only if no filtering options (-r or PATH) are specified.

Without knowing the code, it seems that the revset is needed (as in the bare jj log).
If the default can't be set in the config file, then I guess you don't need it when there is a path.

@martinvonz
Copy link
Owner

I agree that it seems better to not use the default revset if any paths were passed. I think that's almost always what I want.

@noahmayr
Copy link
Collaborator Author

noahmayr commented Apr 1, 2024

Regarding #2475, I think the default revset can be turned off if any path arguments are specified.

jj log            # use default revset
jj log -rREV      # REV
jj log PATH       # file(PATH)
jj log -rREV PATH # REV & file(PATH)

It implies that the PATH and REV arguments are basically the same things (with a bit different representations.) WDYT?

I agree that it seems better to not use the default revset if any paths were passed. I think that's almost always what I want.

I added another commit which changes the behavior to reflect this. If it looks good to you I'll restructure the changes

@noahmayr noahmayr requested a review from yuja April 1, 2024 08:37
@yuja
Copy link
Collaborator

yuja commented Apr 1, 2024

   // if no args are passed, use default revset
   // if only paths are passed, filter by paths
   // if only a revset is passed, use the revset

These sound good to me, thanks.

   // if paths and revset are passed, use both but try dropping the revset if the
   // paths are not contained in it

Meh, no. If the user specified both, it's clear that they want to filter by both revset and paths.

BTW, I've changed workspace_command.*revset() APIs recently. We might need to make attach_revset_evaluator() public so the "only paths" case can be started from RevsetExpresssion::all().

@noahmayr noahmayr force-pushed the push-wswrywxzsvtm branch 11 times, most recently from 54d954c to 7d23f43 Compare April 1, 2024 10:34
Copy link
Collaborator

@yuja yuja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks. Can you squash these patches? We usually include doc/tests changes in the commit which introduce the new behavior.

cli/src/commands/log.rs Outdated Show resolved Hide resolved
cli/src/commands/log.rs Outdated Show resolved Hide resolved
@noahmayr noahmayr force-pushed the push-wswrywxzsvtm branch 2 times, most recently from f9c537a to 1582629 Compare April 1, 2024 13:51
Copy link
Collaborator

@yuja yuja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

cli/src/commands/log.rs Outdated Show resolved Hide resolved
docs/config.md Outdated Show resolved Hide resolved
cli/src/commands/log.rs Show resolved Hide resolved
@ilyagr
Copy link
Collaborator

ilyagr commented Apr 2, 2024

Also, thank you!

Copy link
Owner

@martinvonz martinvonz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

docs/config.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@ilyagr ilyagr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you needed to wait for my approval, but just in case.

@noahmayr
Copy link
Collaborator Author

noahmayr commented Apr 2, 2024

I don't think you needed to wait for my approval, but just in case.

I'm not allowed to merge though, but judging by the fact that my name just turned green on discord I assume someone is already working on that :)

@martinvonz
Copy link
Owner

I'm not allowed to merge though, but judging by the fact that my name just turned green on discord I assume someone is already working on that :)

I actually thought I already had done that. Done now anyway.

@noahmayr noahmayr merged commit b799848 into martinvonz:main Apr 3, 2024
16 checks passed
@noahmayr noahmayr deleted the push-wswrywxzsvtm branch April 3, 2024 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants