in git-server-tc/src/main/java/jetbrains/buildServer/buildTriggers/vcs/git/GitExternalChangeViewerExtension.java [24:86]
public Map<String, String> getAvailableProperties(@NotNull final VcsRoot vcsRoot) {
if (!Constants.VCS_NAME.equals(vcsRoot.getVcsName())) return null;
String url = vcsRoot.getProperty(Constants.FETCH_URL);
if (url == null) return null;
URIish urIish;
try {
urIish = new URIish(url);
} catch (URISyntaxException e) {
return null;
}
VcsHostingRepo vcsHostingRepo = WellKnownHostingsUtil.getGitHubRepo(urIish);
if (vcsHostingRepo != null) {
final VcsHostingRepo finalVcsHostingRepo = vcsHostingRepo;
return new HashMap<String, String>() {{
put(PropertyType.CHANGE_SET_TYPE, finalVcsHostingRepo.repositoryUrl() + "/commit/${changeSetId}");
put(PropertyType.LINK_TEXT, "Open in GitHub");
put(PropertyType.LINK_ICON_CLASS, "tc-icon_github");
}};
}
vcsHostingRepo = WellKnownHostingsUtil.getBitbucketRepo(urIish);
if (vcsHostingRepo != null) {
final VcsHostingRepo finalVcsHostingRepo = vcsHostingRepo;
return new HashMap<String, String>() {{
put(PropertyType.CHANGE_SET_TYPE, finalVcsHostingRepo.repositoryUrl() + "/commits/${changeSetId}");
put(PropertyType.LINK_TEXT, "Open in Bitbucket Cloud");
put(PropertyType.LINK_ICON_CLASS, "tc-icon_bitbucket");
}};
}
vcsHostingRepo = WellKnownHostingsUtil.getGitlabRepo(urIish);
if (vcsHostingRepo != null) {
final VcsHostingRepo finalVcsHostingRepo = vcsHostingRepo;
return new HashMap<String, String>() {{
put(PropertyType.CHANGE_SET_TYPE, finalVcsHostingRepo.repositoryUrl() + "/commit/${changeSetId}");
put(PropertyType.LINK_TEXT, "Open in Gitlab.com");
}};
}
vcsHostingRepo = WellKnownHostingsUtil.getVSTSRepo(urIish);
if (vcsHostingRepo != null) {
final VcsHostingRepo finalVcsHostingRepo = vcsHostingRepo;
return new HashMap<String, String>() {{
put(PropertyType.CHANGE_SET_TYPE, finalVcsHostingRepo.repositoryUrl() + "/commit/${changeSetId}");
put(PropertyType.LINK_TEXT, "Open in Azure DevOps Services");
put(PropertyType.LINK_ICON_CLASS, "tc-icon_tfs");
}};
}
vcsHostingRepo = WellKnownHostingsUtil.getBitbucketServerRepo(urIish);
if (vcsHostingRepo != null) {
final VcsHostingRepo finalVcsHostingRepo = vcsHostingRepo;
return new HashMap<String, String>() {{
put(PropertyType.CHANGE_SET_TYPE, finalVcsHostingRepo.repositoryUrl() + "/commits/${changeSetId}");
put(PropertyType.LINK_TEXT, "Open in Bitbucket Server");
put(PropertyType.LINK_ICON_CLASS, "tc-icon_bitbucket");
}};
}
return null;
}