Search in sources :

Example 1 with GitRebaseParams

use of git4idea.branch.GitRebaseParams in project intellij-community by JetBrains.

the class GitRebaseProcess method notifySuccess.

private void notifySuccess(@NotNull Map<GitRepository, GitSuccessfulRebase> successful, final MultiMap<GitRepository, GitRebaseUtils.CommitInfo> skippedCommits) {
    String rebasedBranch = getCommonCurrentBranchNameIfAllTheSame(myRebaseSpec.getAllRepositories());
    List<SuccessType> successTypes = map(successful.values(), GitSuccessfulRebase::getSuccessType);
    SuccessType commonType = getItemIfAllTheSame(successTypes, SuccessType.REBASED);
    GitRebaseParams params = myRebaseSpec.getParams();
    String baseBranch = params == null ? null : notNull(params.getNewBase(), params.getUpstream());
    if ("HEAD".equals(baseBranch)) {
        baseBranch = getItemIfAllTheSame(myRebaseSpec.getInitialBranchNames().values(), baseBranch);
    }
    String message = commonType.formatMessage(rebasedBranch, baseBranch, params != null && params.getBranch() != null);
    message += mentionSkippedCommits(skippedCommits);
    myNotifier.notifyMinorInfo("Rebase Successful", message, new NotificationListener.Adapter() {

        @Override
        protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
            handlePossibleCommitLinks(e.getDescription(), skippedCommits);
        }
    });
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) GitRebaseParams(git4idea.branch.GitRebaseParams) SuccessType(git4idea.rebase.GitSuccessfulRebase.SuccessType) Notification(com.intellij.notification.Notification) NotificationListener(com.intellij.notification.NotificationListener)

Aggregations

Notification (com.intellij.notification.Notification)1 NotificationListener (com.intellij.notification.NotificationListener)1 GitRebaseParams (git4idea.branch.GitRebaseParams)1 SuccessType (git4idea.rebase.GitSuccessfulRebase.SuccessType)1 HyperlinkEvent (javax.swing.event.HyperlinkEvent)1