-
Notifications
You must be signed in to change notification settings - Fork 915
Register icons for git stash and nb shelve actions #8373
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
Conversation
| // TODO git unstash in shelve action? | ||
|
|
||
| @NbBundle.Messages({ | ||
| "CTL_UnstashMenu.name=&Git Unstash", | ||
| "CTL_UnstashMenu.name.popup=Git Unstash", | ||
| "# {0} - stash index", "# {1} - stash name", "CTL_UnstashAction.name={0} - {1}" | ||
| }) | ||
| private static class UnshelveMenu { | ||
| private static class UnstashMenu { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this might indicate that things were copied around. Git unstash should not be in the shelve action.
this lead also to this:
netbeans/ide/versioning.util/src/org/netbeans/modules/versioning/shelve/impl/ShelveChangesMenu.java
Lines 152 to 153 in e2dce56
| // actions depending on the central patch storage | |
| ShelveChangesActionProvider actionProvider = ShelveChangesActionsRegistry.getInstance().getActionProvider(vs[0]); |
which is not the patch storage, but the git unstash action (unshelve is actually registered a few lines before that)
but this would be for other PRs.
4c5e954 to
a667b48
Compare
So that they can be added to the toolbar.
a667b48 to
e78d951
Compare
| // TODO pick/create better icon | ||
| @StaticResource | ||
| private static final String ICON_RESOURCE = "org/netbeans/modules/git/resources/icons/get_clean.png"; //NOI18N |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eirikbakke having icons for "git stash" and "shelve changes" would be great I think. Possibly the clean icon combined with the diff icon or something like that? (not for NB 26, maybe some day later)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I can look at that the next time I'm doing icon stuff.
Where does the word "shelve" come from? It sounds synonymous with "stash", but it's not an actual git command. Looking at this StackOverflow question, it's an IntelliJ term that seems to confuse users. Maybe it should be renamed in the NetBeans UI?
Git stash via jgit does also only support repo wide "stash push", while shelve works on the selection.
What is the "selection" referred to here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shelve is used in Subversion, Perforce and Mercurial (with some extensions). They are used for similar purpose as git stash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shelve moves changes into patch files and stores those locally, this should work on any VCS. Stash is just git stash. Shelve will only shelve the selected files. Stash will stash the whole repo since I don't think jgit supports file stashing yet (git does for quite a while).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, maybe I understand now. Perhaps "Stash to Patch File" might be a better name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the icon I drew for Shelve, if you think it makes sense:
For stash, we could use ide/git/src/org/netbeans/modules/git/resources/icons/stashes.png, which I have redrawn in SVG as follows:
(The latter is part of #8424 )
I can install those two icons in a separate PR later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did this PR actually add the Stash and Shelve actions to a toolbar somewhere? Which toolbar is it, and how do I access it? (Can't see the context from the very cropped screenshot on top.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it only registered the icons for the actions, this is the precondition to add something to the toolbar. User has to do this manually via right click -> customize toolbar.
That is why it wasn't super important for me to pick the right icons. It is just for testing purposes mostly and to get an idea how useful shelve still is. We should update them to the new icons for NB 27 though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, now I see. Thanks! One annoying thing about the main toolbar is that icons shown there must be prepared in both 16x16 and 24x24 versions. But I can do it for this action. (One would think that the SVG could just be scaled up 150%, but it doesn't look good, as borders end up with a non-standard thickness, and horizontal/vertical lines get pushed off the pixel grid.)
matthiasblaesing
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I agree, that wording/nesting/workflow might be improved, the target of this PR is clearly spelled out and improves situation for people needing the actions.
Updated icons would be great, but that is also independent from this PR and also independent from the wording.
Lets get this in, it is an improvement.

So that they can be added to the tool bar.
The action registration in the context menu is a bit of a mess right now. Git stash via jgit does also only support repo wide "stash push", while shelve works on the selection. This isn't communicated anywhere in the UI though, so I updated the text for the shelve action to "Shelve selected Changes".
The way to get to the shelve action is via the stash window - which is super weird (one is global the other is selection based). Custom toolbar makes this easier.