void () { GitCompoundResult checkoutResult = new GitCompoundResult(myProject); GitCompoundResult deleteResult = new GitCompoundResult(myProject); Collection<GitRepository> repositories = getSuccessfulRepositories(); for (GitRepository repository : repositories) { GitCommandResult result = myGit.checkout(repository, myCurrentHeads.get(repository), null, true, false); checkoutResult.append(repository, result); if (result.success()) { deleteResult.append(repository, myGit.branchDelete(repository, myNewBranchName, false)); } refresh(repository); } if (checkoutResult.totalSuccess() && deleteResult.totalSuccess()) { String message = GitBundle .message("checkout.new.branch.operation.checked.out.0.and.deleted.1.on.2.3", stringifyBranchesByRepos(myCurrentHeads), code(myNewBranchName), repositories.size(), successfulRepositoriesJoined()); VcsNotifier.getInstance(myProject).notifySuccess(CHECKOUT_NEW_BRANCH_OPERATION_ROLLBACK_SUCCESSFUL, GitBundle.message("checkout.new.branch.operation.rollback.successful"), message); } else { @NlsContexts.NotificationContent StringBuilder message = new StringBuilder(); if (!checkoutResult.totalSuccess()) { message.append(GitBundle.message("checkout.new.branch.operation.errors.during.checkout")); message.append(checkoutResult.getErrorOutputWithReposIndication()); } if (!deleteResult.totalSuccess()) { message.append(GitBundle.message("checkout.new.branch.operation.errors.during.deleting", code(myNewBranchName))); message.append(deleteResult.getErrorOutputWithReposIndication()); } VcsNotifier.getInstance(myProject) .notifyError(CHECKOUT_NEW_BRANCH_OPERATION_ROLLBACK_ERROR, GitBundle.message("checkout.new.branch.operation.error.during.rollback"), message.toString(), true); } }