jjui icon indicating copy to clipboard operation
jjui copied to clipboard

FR: Handle custom diff/merge tools

Open rokups opened this issue 5 months ago • 12 comments

It seems like jjui does not handle custom diff tools. I have following in my config:

[ui]
diff-formatter = ["/usr/bin/bcompare", "$left", "$right", "-expandall"]
diff-editor = ["/usr/bin/bcompare", "$left", "$right", "-expandall"]
merge-editor = ["/usr/bin/bcompare", "$left", "$right", "$base", "$output"]

Opening a preview panel opens beyond compare. Navigating through the log with preview open keeps reopening beyond compare for each commit too.

It would probably be best if custom diff tools would be used selectively: ignored for certain ops and used for others. However, i can not provide exact list, as i am trying the app for less than a day. Opening a diff could be one such example where opening external tool would be desired. Selective merging/splitting too.

Or, as a quick QOL improvement, ignoring custom diff tools completely for now would make using the app less disruptive.

P.S. You created a surprisingly clean and nice to use app, kudos! Videos in the README do not do the justice for this app. Thank you for your hard work 🙏

rokups avatar Jul 25 '25 06:07 rokups

Hey, thanks!

You can change the command that runs to get the preview to any command you like, the output of the command will be displayed in the preview window. You can find the configuration here: https://github.com/idursun/jjui/wiki/Preview

You can edit the config file by running jjui --config. It will come up empty. You can copy the configuration section from the wiki page and modify the commands to use a different diff tool.

Beyond Compare is a GUI, so that's why it is popping up with every change. Since jjui is a TUI, the diff tool needs to output to the stdout.

In you case, you can add a configuration override like the following:

[preview]
revision_command = ["show", "--color", "always", "-r", "$change_id", "--config", "ui.diff-formatter=delta"]

idursun avatar Jul 25 '25 06:07 idursun

P.S. You created a surprisingly clean and nice to use app, kudos!

Thanks! 🫶

Videos in the README do not do the justice for this app.

Do you mean they don't do a good job of showing the real experience when using the app?

idursun avatar Jul 25 '25 07:07 idursun

Do you mean they don't do a good job of showing the real experience when using the app?

I love the gifs you share in docs, they are an easy way to show people or at least make us imagine how powerful workflows we could unlock by using jjui, that was the case for me, and I love when you add screenshots and gifs.

<offtopic> However, I also think gifs and screenshorts ARE documentation. And just like any other documentation they tend to get outdated as the project grows and we add new features. Updating screenshots or gifs to reflect latest looks or features can be time consuming, just like updating any documentation.

Because of this, I was thinking something I'll explore in the coming days: Use vhs and steno to have a directory of vhs tapes and some utility scripts that setup an example jj repo and perform some operations using jjui, this way we can create updated gifs and screenshots (vhs allows also capturing an image on a given point of time)

For each feature we could write a vhs tape that demo its usage, and we could re-run these vhs scripts when needed to get updated images as part of our wiki docs. </offtopic>

vic avatar Jul 25 '25 07:07 vic

screenshorts

hahaha forgive my english and my phone auto-corrector, we both are bad.

vic avatar Jul 25 '25 07:07 vic

@vic recording tapes are already here: https://github.com/idursun/jjui_recordings

idursun avatar Jul 25 '25 07:07 idursun

awesome, will contribute to that repo then :)

vic avatar Jul 25 '25 07:07 vic

Do you mean they don't do a good job of showing the real experience when using the app?

Most videos have log alone, or at least show log alone initially. When i was looking over jj GUIs i skimmed over all of them to see if anything catches the eye. I suppose what could be really useful for catching more users - a screenshot with as much details as possible, at the top of README. You know, to create the first impression that catches the eye and encourages to investigate further.

In you case, you can add a configuration override like the following:

Any idea if it is possible to unset the config this way? Or set it to default? I am unable to figure out. In any case, i suppose this solves my request and we can close the issue.

rokups avatar Jul 25 '25 10:07 rokups

Any idea if it is possible to unset the config this way? Or set it to default?

Sorry, I am not following. The change I recommended will change the command ran for the preview.

idursun avatar Jul 26 '25 08:07 idursun

Right, what i am trying to do is to use the default, whatever jj uses when this setting is not set. Any idea if that is possible?

rokups avatar Jul 26 '25 08:07 rokups

Ah, I see. In that case, your diff formatter should be :git

[preview]
revision_command = ["show", "--color", "always", "-r", "$change_id", "--config", "ui.diff-formatter=:git"]

idursun avatar Jul 26 '25 09:07 idursun

That works, thank you 🙏 I took another look at how things work and i suppose there is something to improve. revision_command apparently only affects preview panel, which is good enough for me. All other actions invoke beyond-compare, which is probably ok for the most part. I am not entirely sure what i would like to see when looking at a diff of a single file, for example. Maybe a smaller diff inside app window could be preferrable, not sure. Multi-file diffs or splitting - beyond compare opens and it is preferable here.

Potential improvements:

  • Some people may find more config options for cases mentioned above useful. I would most likely change a single file diff option if there was such.
  • jjui currently shows an empty diff window after i close beyond compare. This step could be skipped if invoked diff app returned empty stdout.

rokups avatar Jul 28 '25 05:07 rokups

I think I understand what @rokups is experiencing and will try to put it in my own words:

@idursun Yes, currently the jj command that is invoked by the jjui "preview" is able to be modified. However, it seems there is no way to override the jjui "diff" view, which ostensibly just runs jj diff.

My use case is this:

  • When using bare jj diff in the CLI, I want to invoke delta as the diff viewer without the delta side-by-side feature
  • When viewing the "preview" in jjui, I want to invoke jj with the default diff view, in my case using delta non side-by-side (although in jjui I would be able to override the command used for preview as you showed)
  • When viewing the "diff" view in jjui, I want to invoke jj with a different diff view, that does use the side-by-side feature (it doesn't seem like this is possible in jjui today)

Hopefully that makes it clearer

I think to implement this feature, we just need a [preview.diff_command] config key

rockboynton avatar Nov 25 '25 23:11 rockboynton