Search in sources :

Example 1 with GithubRepoDetailed

use of org.jetbrains.plugins.github.api.data.GithubRepoDetailed in project intellij-community by JetBrains.

the class GithubCreatePullRequestWorker method doLoadForksFromGithub.

private void doLoadForksFromGithub(@NotNull ProgressIndicator indicator) throws IOException {
    GithubRepoDetailed repo = GithubUtil.runTask(myProject, myAuthHolder, indicator, connection -> 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();
}
Also used : GithubRepoDetailed(org.jetbrains.plugins.github.api.data.GithubRepoDetailed)

Example 2 with GithubRepoDetailed

use of org.jetbrains.plugins.github.api.data.GithubRepoDetailed in project intellij-community by JetBrains.

the class GithubShareProjectTest method checkGithubExists.

protected void checkGithubExists() throws IOException {
    GithubAuthData auth = myGitHubSettings.getAuthData();
    GithubRepoDetailed githubInfo = GithubApiUtil.getDetailedRepoInfo(new GithubConnection(auth), myLogin1, PROJECT_NAME);
    assertNotNull("GitHub repository does not exist", githubInfo);
}
Also used : GithubConnection(org.jetbrains.plugins.github.api.GithubConnection) GithubRepoDetailed(org.jetbrains.plugins.github.api.data.GithubRepoDetailed) GithubAuthData(org.jetbrains.plugins.github.util.GithubAuthData)

Example 3 with GithubRepoDetailed

use of org.jetbrains.plugins.github.api.data.GithubRepoDetailed in project intellij-community by JetBrains.

the class GithubRebaseAction method configureUpstreamRemote.

@Nullable
static String configureUpstreamRemote(@NotNull Project project, @NotNull GitRepository gitRepository, @NotNull ProgressIndicator indicator) {
    GithubRepoDetailed repositoryInfo = loadRepositoryInfo(project, gitRepository, indicator);
    if (repositoryInfo == null) {
        return null;
    }
    if (!repositoryInfo.isFork() || repositoryInfo.getParent() == null) {
        GithubNotifications.showWarningURL(project, CANNOT_PERFORM_GITHUB_REBASE, "GitHub repository ", "'" + repositoryInfo.getName() + "'", " is not a fork", repositoryInfo.getHtmlUrl());
        return null;
    }
    final String parentRepoUrl = GithubUrlUtil.getCloneUrl(repositoryInfo.getParent().getFullPath());
    LOG.info("Adding GitHub parent as a remote host");
    indicator.setText("Adding GitHub parent as a remote host...");
    if (GithubUtil.addGithubRemote(project, gitRepository, "upstream", parentRepoUrl)) {
        return parentRepoUrl;
    } else {
        return null;
    }
}
Also used : GithubRepoDetailed(org.jetbrains.plugins.github.api.data.GithubRepoDetailed) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

GithubRepoDetailed (org.jetbrains.plugins.github.api.data.GithubRepoDetailed)3 Nullable (org.jetbrains.annotations.Nullable)1 GithubConnection (org.jetbrains.plugins.github.api.GithubConnection)1 GithubAuthData (org.jetbrains.plugins.github.util.GithubAuthData)1