FR: Global modifier to allow --ignore-immutable on operations
Is your feature request related to a problem? Please describe.
The current implementation to add --ignore-immutable to the jj command-line (as described in #248) is hard to discover and can be applied only at certain places.
Describe the solution you'd like
As --ignore-immutable is a global option, I propose introducing a global flag that could be toggled by a (configurable) key press (e.g. !). Triggering this flag, would be displayed also prominently in the status row. Whenever a (modifying) jj operation is done in response of user interaction (let's say those operations that appear in the oplog), the --ignore-immutable flag could be added and after a successful operation, the flag could be cleared. Whenever the user wants to override immutability, they just have to press ! and do whatever they wanted without keeping in mind that different keys must be pressed later. e.g. to edit an immutabe change, you would just press ! e, or for rebase ! r ... enter or r ... ! enter whichever is more natural for you.
Why current features fail to cover this request Currently the feature can be discovered only by reading the documentation/changelogs. Also it can be applied only at certain places. e.g. rebase
Additional context I'm not sure about the internals, but the flag must be cleared only on operations that may mutate the repo. It is also ok to clear the flag even on operations that would not require it (i.e. doing something on a mutable change could also clear it). The main thing is that it would be in ON state for as short time as possible. (internal calls like refreshing the log etc. should not clear it though)
Hey, thanks for the detailed description.
I have a couple of ideas that I'd like to explore before shaping this and some similar usages (e.g. keep emptied and interactive modifiers of the squash operation) into an implementation first. I am going to update this once I have something to share.
hey @idursun ,
one of the ideas i have with this is, for the immutables, instead of failing the operation directly, the user would be prompted with a confirmation window with something like "this revision is immutable, continue with --ignore-immutable?"
lemme know what you think!
example workflow:
- user presses
eon a immutable revision - execution of
jj edit $revisionfails - a confirmation window pops up with:
Error: Commit $commitID is immutable
press enter to apply --ignore-immutable
- user presses
enter - confirmation window closes,
jj edit $revision --ignore-immutableis executed
While this is definitely a more lean workflow and a lot better discoverable than having a modifier key pressed before the execution I fear that this is way too easy and muscle memory will just kick in too fast on these prompts. On the other hand, I see why this is a lot easier for the users and it requires 0 knowledge in advance. Maybe a configurable accept key or at least not something such easy as [enter] (I myself would definitely re-configure it to something less obvious)
In fact, if I would configure it to be ! key, then it would more or less give back my previous recommendation with the the advantage of more discoverability.