-
Notifications
You must be signed in to change notification settings - Fork 321
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
Add a TUI for editing diffs #48
Comments
This would also be useful for git-branchless for the same reasons. The TUI which I was used to with |
Yes. If I start working on a TUI for editing diffs, I'll probably start making it part of jj, but then I hope to make it standalone. That probably involves moving out diffing to a separate crate so it can be depended on from both
That's also the UI I'm used to. The biggest problem I have with that is that it's really hard to edit the patch itself (after pressing
Except that there I don't know of any good terminal-based mergetool... :( |
What are the deficiencies of the terminal-based mergetools which you've used? |
I don't think I've used any at all. I've started Can you recommend any? |
I was using The bottom window is the actual buffer you want to edit. The top three show the "local", "base", and "remote" snapshots of the file for your reference (i.e. the components of the three-way diff). The diff coloration updates as you edit, and all the buffers should scroll in sync. You could also simply edit one of the above three windows and overwrite the target file, if you prefer not to use the conflict marker mechanism. |
Thanks. I just tried |
I quite often want to move the changes to a particular file from one commit to another. We already support that using `jj move -i`, but that can be annoying to run because we don't have a TUI for it (#48). Let's make it possible to do `jj move --from X --to Y <path>`.
I quite often want to move the changes to a particular file from one commit to another. We already support that using `jj move -i`, but that can be annoying to run because we don't have a TUI for it (#48). Let's make it possible to do `jj move --from X --to Y <path>`.
I quite often want to move the changes to a particular file from one commit to another. We already support that using `jj move -i`, but that can be annoying to run because we don't have a TUI for it (#48). Let's make it possible to do `jj move --from X --to Y <path>`.
As an additional data point, git-crecord offers a TUI for selecting changes to stage/commit on an line-by-line basis. IIUC it doesn't allow actually editing the diff contents, but it has a dynamic expanding/collapsing interface that may be an interesting feature to consider (although a one-hunk-at-a-time approach like what |
Thanks. I'd seen git-crecord, and I've used the orginal implementation for Mercurial a lot, but I had somehow not considered using it with jj :) Most of the time you don't need to edit the diff, so it seems fine if that's not supported to start with. I haven't spent much time looking through the code, but I would think most of it is reusable outside of git. I know Mercurial's crecord code actually works on the diff itself, while jj's configurable diff-editor works on two states (which tools like Also, rumor has it that @arxanas is working on a TUI like this for (presumably for https://github.com/arxanas/git-branchless, but should be reusable). |
I quite often want to move the changes to a particular file from one commit to another. We already support that using `jj move -i`, but that can be annoying to run because we don't have a TUI for it (#48). Let's make it possible to do `jj move --from X --to Y <path>`.
I quite often want to move the changes to a particular file from one commit to another. We already support that using `jj move -i`, but that can be annoying to run because we don't have a TUI for it (#48). Let's make it possible to do `jj move --from X --to Y <path>`.
PR for the TUI which I'm working on: arxanas/git-branchless#343 Embedding the git-crecord Python library/binary might be a pragmatic option, too, although it's GPL-2-only. |
Is there a config to use VSCode for this in the meantime? I tried |
Try something like this. ui.diff-editor = "vscode"
[merge-tools.vscode]
program = "code"
edit-args = ["--wait", "--diff"] |
Thanks for suggesting something @yuja FYI this does open VSCode with the files, but not a diff editor. But no great stress... |
Update: #1211 added variable expansion, and ui.diff-editor = "code" # equivalent to ["code", "$left", "$right"]
ui.diff-editor = ["code", "--wait", "--diff", "$left", "$right"] (I have no idea about the option to forcibly open a diff editor.) |
VS Code doesn't support diffing directories out of the box, only one file at a time. I found https://marketplace.visualstudio.com/items?itemName=moshfeu.compare-folders that claims to be runnable from the command line, but I haven't tried it. A script could also be written. I'm not sure what the best approach is, but it should be possible using |
Shall we close this? We now bundle scm-record into jj, and we can invoke external diff editors as desired. It's true that scm-record doesn't let you edit hunks directly, which is sometimes useful. It might be better to open a feature request for that specifically. |
Yes, I agree. Thanks for creating scm-record and the integration! |
Surprisingly, there doesn't seem to be a good TUI tool for editing diffs. We need this for
jj touchup
,jj split
, etc. We want a tool that can present the diff and let the user edit the right side of it. It should ideally support diffing directories.vimdiff
might be the closest, but it doesn't support directories by default (it seems you need to install some plugin) and it's not intuitive.The text was updated successfully, but these errors were encountered: