jjui icon indicating copy to clipboard operation
jjui copied to clipboard

FR: Abandon files from details view

Open nickchomey opened this issue 2 months ago • 8 comments

Is your feature request related to a problem? Please describe.

I regularly want to abandon specific files from a particular revision

Describe the solution you'd like

ability to use a to abandon selected files while in details view

Describe alternatives you've considered

The only way I can find to do this is to split then abandon the new commit.

nickchomey avatar Oct 17 '25 02:10 nickchomey

I've also been doing split to abandon, and agree it would be great to abandon a specific file right from details view.

vic avatar Oct 17 '25 02:10 vic

How is this different than using r to restore files in details view?

idursun avatar Oct 17 '25 07:10 idursun

I don't follow what you mean. Would you mind elaborating a bit?

nickchomey avatar Oct 17 '25 08:10 nickchomey

Sure.

ability to use a to abandon selected files while in details view

As I understand it, this means discarding changes made to a file in the revision. That's the equivalent of what r does in the details view. If you select some files and hit r and hit enter then those files will be removed from that revision (effectively changes made to those files will be discarded/abandoned).

idursun avatar Oct 17 '25 08:10 idursun

Wow. all this time, both vic and I (and surely others) have been going through tremendous complexity to do this...

So, perhaps all that is needed is to rename restore to something else?

I can see that it is calling the jj restore command, which the docs describe it as Restore paths from another revision. And the -c option is specifically Undo the changes in a revision as compared to the merge of its parents. That is, of course, what is necessary and happening. I see no problem with how jj restore is described.

But jjui doesnt expose the flags/options, so just calling it "restore" is evidently confusing - to me, it connotes restoring the currently selected items to somewhere else (eg how the oplog and evolog work).

Perhaps it could be called discard, which is what VS Code calls it even though there's no underlying git discard?

Image

Or, as originally proposed here, to align with the non-details view commands, just call it it abandon? Or restore/abandon? Whether to change the default hotkey from r to a, I'm not sure - it could be disruptive to those who are accustomed to r

nickchomey avatar Oct 17 '25 09:10 nickchomey

Wow. all this time, both vic and I (and surely others) have been going through tremendous complexity to do this...

TIL... it'd be a good idea to call it abandon with keybind a!

though i do recognize my being unaware of this is due to the fact that i never used jj restore itself...

baggiiiie avatar Oct 17 '25 14:10 baggiiiie

Ok, interesting. Having two veterans of the jjui missed this feature speaks for itself.

However, I personally find calling an action with a different name than the name of the command that runs confusing and unpredictable. In this context, abandon makes more sense than restore, but restore is also not totally off and it is what's being called under the hood. Most of the jj commands are very flexible and can do more than what their name suggests.

Having a look at the abandon command description, I see the following:

Abandon a revision, rebasing descendants onto its parent(s). The behavior is similar to jj restore --changes-in; the difference is that jj abandon gives you a new change, while jj restore updates the existing change.

Given the description above, I believe restore is a better match than abandon as it is exactly matching the intent of the r action.

idursun avatar Oct 17 '25 21:10 idursun

Would a label like restore/abandon be too long?

nickchomey avatar Oct 18 '25 00:10 nickchomey