-
Notifications
You must be signed in to change notification settings - Fork 894
Add missinng logic for delete a local branch #8650
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
base: master
Are you sure you want to change the base?
Conversation
Thx, everything seems to work correctly beacuse if smth is wrong here, there witll be a GitException which shows the error: delete.checkout.branch.mp4So I'm fine with this behaviour. |
right, saw that. This isn't great. Tools should not offer actions for operations which aren't supported by the impl. |
So you mean just disable the ok butten when the current checked out branch is selected? |
something like that yeah, although removing the current branch from the list might be easier since it wouldn't involve having to update the branch selector UI which is probably used in many places. not tested: action: RepositoryInfo info = RepositoryInfo.getInstance(repository);
HashMap<String, GitBranch> branches = new HashMap<>(info.getBranches());
branches.remove(info.getActiveBranch().getName());
if (branches.isEmpty()) {
// TODO notify: "can't delete active branch"
return;
}
BranchSelector selector = new BranchSelector(repository, branches); new BranchSelector constructor: public BranchSelector(File repository, HashMap<String, GitBranch> branches) {
this.revisionPicker = new RevisionDialogController(repository, new File[0], branches, null);
panel = new SelectBranchPanel(revisionPicker.getPanel());
} would be nice to overwrite the enable() method of the action and turn it off if there is just one branch, but I am not 100% if it is a good idea to run the branch query on the EDT, I haven't looked into this deeper. |
enable method:
with that method you don't need the TODO |
@mbien added your requested code, I tested it with quick search -> delete branch, Menu -> team -> git -> branch ->delete branch and with the popup action on the project node. Seem working now. Thx. |
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.
added a comment, there is now also a merge conflict to resolve.
please squash to one commit before integration - other than that looks good to me
ide/git/src/org/netbeans/modules/git/ui/branch/DeleteBranchAction.java
Outdated
Show resolved
Hide resolved
7addf3e
to
91d7d70
Compare
# Conflicts: # ide/git/src/org/netbeans/modules/git/ui/menu/BranchMenu.java
91d7d70
to
22a3da8
Compare
If there are no other concerns, I will probably merge this next week. |
The logic was still implemented but action items are missing and the logic to select a branch to delete it. The problem was, when you do a quick search for delete, the delete was found and the UnsupportedOperationException was thrown. Now everything works as expected.
PR approval and merge checklist:
If this PR targets the delivery branch: don't merge. (full wiki article)