package zielu.gittoolbox.fetch;

import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.Task.Backgroundable;
import com.intellij.openapi.project.Project;
import git4idea.GitVcs;
import git4idea.repo.GitRepository;
import git4idea.update.GitFetcher;
import java.util.Collections;
import org.jetbrains.annotations.NotNull;
import zielu.gittoolbox.ResBundle;

public final class GtFetchUtil {

  private GtFetchUtil() {
    throw new IllegalStateException();
  }

  /**
   * Fetch for single repository.
   * Taken from {@link git4idea.actions.GitFetch}
   *
   * @param repository repository to fetch
   */
  public static void fetch(GitRepository repository) {
    Project project = repository.getProject();
    GitVcs.runInBackground(new Backgroundable(project, ResBundle.getString("message.fetching"), true) {
      public void run(@NotNull ProgressIndicator indicator) {
        (new GitFetcher(project, indicator, true)).fetchRootsAndNotify(Collections.singleton(repository), null, true);
      }
    });
  }
}

@@ -61,336 +61,125 @@
 .pro
-gress.ProgressIndicator;%0Aimport com.intellij.openapi.progress.Task.Backgroundable;%0Aimport com.intellij.openapi.project.Project;%0Aimport git4idea.GitVcs;%0Aimport git4idea.repo.GitRepository;%0Aimport git4idea.update.GitFetcher;%0Aimport java.util.Collections;%0Aimport org.jetbrains.annotations.NotNull;%0Aimport zielu.gittoolbox.ResBundle
+ject.Project;%0Aimport git4idea.fetch.GitFetchSupport;%0Aimport git4idea.repo.GitRepository;%0Aimport java.util.Collections
 ;%0A%0Ap
@@ -538,237 +538,107 @@
  Git
-Vcs.runInBackground(new Backgroundable(project, ResBundle.getString(%22message.fetching%22), true) %7B%0A      public void run(@NotNull ProgressIndicator indicator) %7B%0A        (new GitFetcher(project, indicator, true)).fetchRootsAndNotify
+FetchSupport fetchSupport = GitFetchSupport.fetchSupport(project);%0A    fetchSupport.fetchAllRemotes
 (Col
@@ -671,41 +671,40 @@
 ory)
-, null, true);%0A      %7D%0A    %7D
+).showNotificationIfFailed(
 );%0A  %7D%0A%7D
 %0A
@@ -702,9 +702,8 @@
 );%0A  %7D%0A%7D
-%0A

Remove deprecated fetch API usage