@Nullable
 private List<GithubFullPath> getAvailableForks(@NotNull ProgressIndicator indicator) {
   try {
     List<GithubFullPath> forks =
         ContainerUtil.map(
             GithubUtil.runTask(
                 myProject,
                 myAuthHolder,
                 indicator,
                 new ThrowableConvertor<GithubConnection, List<GithubRepo>, IOException>() {
                   @NotNull
                   @Override
                   public List<GithubRepo> convert(@NotNull GithubConnection connection)
                       throws IOException {
                     return GithubApiUtil.getForks(
                         connection, mySource.getUser(), mySource.getRepository());
                   }
                 }),
             new Function<GithubRepo, GithubFullPath>() {
               @Override
               public GithubFullPath fun(GithubRepo repo) {
                 return repo.getFullPath();
               }
             });
     if (!forks.contains(mySource)) return ContainerUtil.append(forks, mySource);
     return forks;
   } catch (IOException e) {
     GithubNotifications.showWarning(myProject, "Can't load available forks", e);
     return null;
   }
 }
  private void doLoadForksFromGithub(@NotNull ProgressIndicator indicator) throws IOException {
    GithubRepoDetailed repo =
        GithubUtil.runTask(
            myProject,
            myAuthHolder,
            indicator,
            new ThrowableConvertor<GithubConnection, GithubRepoDetailed, IOException>() {
              @NotNull
              @Override
              public GithubRepoDetailed convert(@NotNull GithubConnection connection)
                  throws IOException {
                return GithubApiUtil.getDetailedRepoInfo(
                    connection, myPath.getUser(), myPath.getRepository());
              }
            });

    doAddFork(repo, indicator);
    if (repo.getParent() != null) {
      doAddFork(repo.getParent(), indicator);
    }
    if (repo.getSource() != null) {
      doAddFork(repo.getSource(), indicator);
    }

    mySource = repo.getSource() == null ? repo.getFullPath() : repo.getSource().getFullPath();
  }
 @Nullable
 private String doLoadDefaultBranch(
     @NotNull final GithubFullPath fork, @NotNull ProgressIndicator indicator) throws IOException {
   GithubRepo repo =
       GithubUtil.runTask(
           myProject,
           myAuthHolder,
           indicator,
           new ThrowableConvertor<GithubConnection, GithubRepo, IOException>() {
             @Override
             public GithubRepo convert(@NotNull GithubConnection connection) throws IOException {
               return GithubApiUtil.getDetailedRepoInfo(
                   connection, fork.getUser(), fork.getRepository());
             }
           });
   return repo.getDefaultBranch();
 }
  @Nullable
  private ForkInfo findRepositoryByUser(
      @NotNull final ProgressIndicator indicator, @NotNull final String user) {
    for (ForkInfo fork : myForks) {
      if (StringUtil.equalsIgnoreCase(user, fork.getPath().getUser())) {
        return fork;
      }
    }

    try {
      GithubRepo repo =
          GithubUtil.runTask(
              myProject,
              myAuthHolder,
              indicator,
              new ThrowableConvertor<GithubConnection, GithubRepo, IOException>() {
                @Nullable
                @Override
                public GithubRepo convert(@NotNull GithubConnection connection) throws IOException {
                  try {
                    GithubRepoDetailed target =
                        GithubApiUtil.getDetailedRepoInfo(
                            connection, user, mySource.getRepository());
                    if (target.getSource() != null
                        && StringUtil.equals(
                            target.getSource().getUserName(), mySource.getUser())) {
                      return target;
                    }
                  } catch (IOException ignore) {
                    // such repo may not exist
                  }

                  return GithubApiUtil.findForkByUser(
                      connection, mySource.getUser(), mySource.getRepository(), user);
                }
              });

      if (repo == null) return null;
      return doAddFork(repo, indicator);
    } catch (IOException e) {
      GithubNotifications.showError(myProject, "Can't find repository", e);
      return null;
    }
  }
 @NotNull
 private List<String> loadBranches(
     @NotNull final GithubFullPath fork, @NotNull ProgressIndicator indicator) throws IOException {
   return ContainerUtil.map(
       GithubUtil.runTask(
           myProject,
           myAuthHolder,
           indicator,
           new ThrowableConvertor<GithubConnection, List<GithubBranch>, IOException>() {
             @Override
             public List<GithubBranch> convert(@NotNull GithubConnection connection)
                 throws IOException {
               return GithubApiUtil.getRepoBranches(
                   connection, fork.getUser(), fork.getRepository());
             }
           }),
       new Function<GithubBranch, String>() {
         @Override
         public String fun(@NotNull GithubBranch branch) {
           return branch.getName();
         }
       });
 }
  @Nullable
  private GithubPullRequest doCreatePullRequest(
      @NotNull ProgressIndicator indicator,
      @NotNull final BranchInfo branch,
      @NotNull final String title,
      @NotNull final String description) {
    final ForkInfo fork = branch.getForkInfo();

    final String head = myPath.getUser() + ":" + myCurrentBranch;
    final String base = branch.getRemoteName();

    try {
      return GithubUtil.runTask(
          myProject,
          myAuthHolder,
          indicator,
          new ThrowableConvertor<GithubConnection, GithubPullRequest, IOException>() {
            @NotNull
            @Override
            public GithubPullRequest convert(@NotNull GithubConnection connection)
                throws IOException {
              return GithubApiUtil.createPullRequest(
                  connection,
                  fork.getPath().getUser(),
                  fork.getPath().getRepository(),
                  title,
                  description,
                  head,
                  base);
            }
          });
    } catch (IOException e) {
      GithubNotifications.showError(myProject, CANNOT_CREATE_PULL_REQUEST, e);
      return null;
    }
  }