Github: fix URL function names

This commit is contained in:
Aleksey Pivovarov
2013-09-28 17:29:35 +04:00
parent 8850c09e7e
commit 64d03a138a
4 changed files with 12 additions and 8 deletions
@@ -170,7 +170,7 @@ public class GithubRebaseAction extends DumbAwareAction {
return null;
}
final String parentRepoUrl = GithubUrlUtil.getGitHost() + '/' + repositoryInfo.getParent().getFullName() + ".git";
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...");
@@ -172,7 +172,7 @@ public class GithubShareAction extends DumbAwareAction {
return;
}
final String remoteUrl = GithubUrlUtil.getGitHost() + "/" + githubInfo.getUser().getLogin() + "/" + name + ".git";
final String remoteUrl = GithubUrlUtil.getCloneUrl(githubInfo.getUser().getLogin(), name);
final String remoteName = finalExternalRemoteDetected ? "github" : "origin";
//git remote add origin git@github.com:login/name.git
@@ -49,7 +49,7 @@ abstract class GithubShowCommitInBrowserAction extends DumbAwareAction {
return;
}
String githubUrl = GithubUrlUtil.getGitHost() + '/' + userAndRepository.getUser() + '/'
String githubUrl = GithubUrlUtil.getGithubHost() + '/' + userAndRepository.getUser() + '/'
+ userAndRepository.getRepository() + "/commit/" + revisionHash;
BrowserUtil.launchBrowser(githubUrl);
}
@@ -20,7 +20,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.github.api.GithubApiUtil;
import org.jetbrains.plugins.github.api.GithubFullPath;
import org.jetbrains.plugins.github.util.GithubSettings;
/**
* @author Aleksey Pivovarov
@@ -62,13 +61,13 @@ public class GithubUrlUtil {
}
/**
* Returns the "host" part of Git URLs.
* Returns the "host" part of Github URLs.
* E.g.: https://github.com
* https://my.company.url
* Note: there is no trailing slash in the returned url.
*/
@NotNull
public static String getGitHost() {
public static String getGithubHost() {
return "https://" + getGitHostWithoutProtocol();
}
@@ -153,7 +152,7 @@ public class GithubUrlUtil {
*/
@Nullable
public static String makeGithubRepoUrlFromRemoteUrl(@NotNull String remoteUrl) {
return makeGithubRepoUrlFromRemoteUrl(remoteUrl, getGitHost());
return makeGithubRepoUrlFromRemoteUrl(remoteUrl, getGithubHost());
}
@Nullable
@@ -177,6 +176,11 @@ public class GithubUrlUtil {
@NotNull
public static String getCloneUrl(@NotNull GithubFullPath path) {
return getGitHost() + "/" + path.getUser() + "/" + path.getRepository() + ".git";
return getCloneUrl(path.getUser(), path.getRepository());
}
@NotNull
public static String getCloneUrl(@NotNull String user, @NotNull String repo) {
return getGithubHost() + "/" + user + "/" + repo + ".git";
}
}