jj icon indicating copy to clipboard operation
jj copied to clipboard

FR: Add a verbose option to `jj git fetch`, (`jj git fetch --verbose`)

Open PhilipMetzger opened this issue 1 year ago • 6 comments

Is your feature request related to a problem? Please describe. This was requested by Julia Evans in Discord, it should display all the things jj git fetch does and the commits it abandoned.

This may help to form a intuition on how Jujutsu works.

PhilipMetzger avatar Feb 17 '24 18:02 PhilipMetzger

There is already a global --verbose that has a wordy output (and that case is when there is nothing to fetch!):

2024-02-18T00:24:14.755214Z  INFO jj_cli::cli_util: verbose logging enabled
2024-02-18T00:24:14.793751Z DEBUG run_command:cmd_git_fetch{args=GitFetchArgs { branch: [Glob(Pattern { original: "*", tokens: [AnySequence], is_recursive: false })], remotes: [], all_remotes: false }}:fetch{remote_name="origin" branch_names=[Glob(Pattern { original: "*", tokens: [AnySequence], is_recursive: false })] git_settings=GitSettings { auto_local_branch: false, abandon_unreachable_commits: true }}: jj_lib::git: remote.download
2024-02-18T00:24:21.623910Z  INFO run_command:cmd_git_fetch{args=GitFetchArgs { branch: [Glob(Pattern { original: "*", tokens: [AnySequence], is_recursive: false })], remotes: [], all_remotes: false }}:fetch{remote_name="origin" branch_names=[Glob(Pattern { original: "*", tokens: [AnySequence], is_recursive: false })] git_settings=GitSettings { auto_local_branch: false, abandon_unreachable_commits: true }}: jj_lib::git: trying ssh_key_from_agent username="git"
2024-02-18T00:24:22.368696Z DEBUG run_command:cmd_git_fetch{args=GitFetchArgs { branch: [Glob(Pattern { original: "*", tokens: [AnySequence], is_recursive: false })], remotes: [], all_remotes: false }}:fetch{remote_name="origin" branch_names=[Glob(Pattern { original: "*", tokens: [AnySequence], is_recursive: false })] git_settings=GitSettings { auto_local_branch: false, abandon_unreachable_commits: true }}: jj_lib::git: remote.prune
2024-02-18T00:24:22.394204Z DEBUG run_command:cmd_git_fetch{args=GitFetchArgs { branch: [Glob(Pattern { original: "*", tokens: [AnySequence], is_recursive: false })], remotes: [], all_remotes: false }}:fetch{remote_name="origin" branch_names=[Glob(Pattern { original: "*", tokens: [AnySequence], is_recursive: false })] git_settings=GitSettings { auto_local_branch: false, abandon_unreachable_commits: true }}: jj_lib::git: remote.update_tips
2024-02-18T00:24:22.395648Z DEBUG run_command:cmd_git_fetch{args=GitFetchArgs { branch: [Glob(Pattern { original: "*", tokens: [AnySequence], is_recursive: false })], remotes: [], all_remotes: false }}:fetch{remote_name="origin" branch_names=[Glob(Pattern { original: "*", tokens: [AnySequence], is_recursive: false })] git_settings=GitSettings { auto_local_branch: false, abandon_unreachable_commits: true }}: jj_lib::git: default_branch="main"
2024-02-18T00:24:22.395656Z DEBUG run_command:cmd_git_fetch{args=GitFetchArgs { branch: [Glob(Pattern { original: "*", tokens: [AnySequence], is_recursive: false })], remotes: [], all_remotes: false }}:fetch{remote_name="origin" branch_names=[Glob(Pattern { original: "*", tokens: [AnySequence], is_recursive: false })] git_settings=GitSettings { auto_local_branch: false, abandon_unreachable_commits: true }}: jj_lib::git: remote.disconnect
2024-02-18T00:24:22.499728Z DEBUG run_command:cmd_git_fetch{args=GitFetchArgs { branch: [Glob(Pattern { original: "*", tokens: [AnySequence], is_recursive: false })], remotes: [], all_remotes: false }}:fetch{remote_name="origin" branch_names=[Glob(Pattern { original: "*", tokens: [AnySequence], is_recursive: false })] git_settings=GitSettings { auto_local_branch: false, abandon_unreachable_commits: true }}: jj_lib::git: import_refs
Nothing changed.

How do we want to improve it ?

poliorcetics avatar Feb 18 '24 00:02 poliorcetics

Maybe we should rename the current --verbose to --debug

martinvonz avatar Feb 18 '24 05:02 martinvonz

A part of this will be implemented by https://github.com/martinvonz/jj/pull/3044

yuja avatar Feb 18 '24 11:02 yuja

Maybe we should rename the current --verbose to --debug

Yes it sounds much better for what it does, I'll open a PR soon

poliorcetics avatar Feb 18 '24 16:02 poliorcetics

#3044 is implemented now. jj git fetch now lists new remote branches and tags. I like it a lot. However, the initial FR is to list commits that were abandoned during fetch if --verbose flag is present. Are there any suggestions or recommendations what information is important to print for an abandoned commit? I think change id and first line of a commit description would be useful. Interested to hear what others think.

zummenix avatar Feb 20 '24 17:02 zummenix

the initial FR is to list commits that were abandoned during fetch if --verbose flag is present.

Maybe we can resurrect 902a43a341ba. The output format is the same as jj abandon.

yuja avatar Feb 21 '24 01:02 yuja

I'm going to propose something here... this may not actually be what we want.

Personally, I don't know that I would use this flag a lot. I noticed today doing a jj git fetch that I had a lot of abandoned commits, but by then, it was too late for me to opt in to seeing them listed as part of the output from the fetch. It seems to me that the philosophy of jujutsu is to not put you into a position where you have to compose some elaborate git query in order to figure something out. So maybe an easy command to list the abandoned commits post facto instead?

MrTact avatar Mar 28 '24 20:03 MrTact

Personally, I don't know that I would use this flag a lot. I noticed today doing a jj git fetch that I had a lot of abandoned commits, but by then, it was too late for me to opt in to seeing them listed as part of the output from the fetch. It seems to me that the philosophy of jujutsu is to not put you into a position where you have to compose some elaborate git query in order to figure something out. So maybe an easy command to list the abandoned commits post facto instead?

I'd argue that a --verbose option is always a niche use-case, but that should not mean that it should be moved to a separate command. It should be enough if we get a message why the commit was abandoned after a jj git fetch --verbose.

PhilipMetzger avatar Mar 30 '24 19:03 PhilipMetzger