jj
jj copied to clipboard
cli split: new change id on the parent
Instead of opening a feature request, I created this quick hack. It lacks a flag comment, and the flag name --left-new
is temporary; it needs further consideration. I'm opening this to gauge interest from more people.
This new flag allows the creation of a jj split
in which we select changes to move back (jj new -B @
).
Let me know if this requires additional context or clarification. Also, please share your thoughts on this feature and whether it's desirable. If it is, let me know how the flag should be named.
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
I like the idea as it goes in the direction which @arxanas proposed here https://github.com/martinvonz/jj/discussions/1905#discussioncomment-6539851. Ideally this would also be implemented in scm-record itself.
Have you seen https://martinvonz.github.io/jj/v0.11.0/config/#experimental-3-pane-diff-editing? That lets you see the left and right originals and the diffs from them to the new middle version.
I have seen it but couldn't get it to work. I installed meld through flatpak, that might be the issue but most likely user error. It's also pretty slow that's why I'm not sure I would use it.
I configured it like that:
diff-editor = [ "flatpak", "run", "org.gnome.meld", "$left", "$base", "$right", "-o", "$output", ]
The $base
wasn't expanded:
Invoking the external diff editor: cmd="flatpak" "run" "org.gnome.meld" "/tmp/jj-diff-6wmxpz/left" "$base" "/tmp/jj-diff-6wmxpz/right" "-o" "/tmp/jj-diff-6wmxpz/output"
I also configured flatpak to let meld access host filesystem with sudo flatpak override org.gnome.meld --filesystem=host
, it has the access when I compare directories manually but it can't see the jj created directories which exist:
The PR/FR addresses I think another issue which I'm not sure meld solves which is picking only small diff and creating a new change before the existing one. It might solve that but even then I'm not sure I'd want to rely on external tool to do that.
Meld also hangs even when it has nothing to diff.
Now that I've looked at the code, this PR seems to be different from what I had originally thought. I thought that it idea was to let you edit the left side of the diff instead of editing the right side. However, it seems that it's actually about choosing which of the two commits should inherit the change id, right?
However, it seems that it's actually about choosing which of the two commits should inherit the change id, right?
That's correct.
@crackcomm
The $base wasn't expanded...
You are supposed to use $output
twice, like in
https://github.com/martinvonz/jj/blob/1cc271441f716549fc9e87e714aacddd2831a4b4/cli/src/config/merge_tools.toml#L12
It is a pretty easy mistake to make...
Update: I hope #2667 will help. I also hope that, one day, we have a better solution to make something like meld-3 work.
Re this PR: If I understand correctly what it does, I was thinking of maybe having such an option and calling it --parent-inherits
(perhaps --parent-inherits-change-id
?), perhaps with the alias -P
. This name is not perfect, but I prefer it to --left-new
.
The option should also affect which commit inherits the branches, and it'd need some tests to double-check what exactly it does (but the tests can be postponed until we decide exactly what the names and functionality should be).
@martinvonz my apologies for the misleading title
@ilyagr thank you for the clarification in meld-3
definition and the suggestion
--left-new
flag is a placeholder, maybe --new-parent
is clearer? perhaps --new-parent-change(-id)
? a short alias would be nice too