Skip to content
Permalink
Browse files
317: git-webrev uses wrong JBS links for commit messages
Reviewed-by: rwestberg
  • Loading branch information
edvbld committed Mar 18, 2020
1 parent 0d08b36 commit c0abd82e75b2cd1c34b46acbc27b9e255e2cd788
Showing 1 changed file with 7 additions and 2 deletions.
@@ -40,6 +40,8 @@
import java.util.stream.Collectors;

public class GitWebrev {
private static final List<String> KNOWN_JBS_PROJECTS =
List.of("JDK", "CODETOOLS", "SKARA", "JMC");
private static void clearDirectory(Path directory) {
try {
Files.walk(directory)
@@ -231,7 +233,7 @@ private static void generate(String[] args) throws IOException {
}
}
if (issue == null) {
var pattern = Pattern.compile("(?:(JDK|CODETOOLS|JMC|SKARA)-)?([0-9]+).*");
var pattern = Pattern.compile("(?:(" + String.join("|", KNOWN_JBS_PROJECTS) + ")-)?([0-9]+).*");
var currentBranch = repo.currentBranch();
if (currentBranch.isPresent()) {
var branchName = currentBranch.get().name().toUpperCase();
@@ -295,13 +297,16 @@ private static void generate(String[] args) throws IOException {
}

var jbs = "https://bugs.openjdk.java.net/browse/";
var issueParts = issue != null ? issue.split("-") : new String[0];
var jbsProject = issueParts.length == 2 && KNOWN_JBS_PROJECTS.contains(issueParts[0])?
issueParts[0] : "JDK";
Webrev.repository(repo)
.output(output)
.title(title)
.upstream(upstream)
.username(author.name())
.commitLinker(hash -> upstreamURL == null ? null : upstreamURL + "/commit/" + hash)
.issueLinker(id -> jbs + (isDigit(id.charAt(0)) ? "JDK-" : "") + id)
.issueLinker(id -> jbs + (isDigit(id.charAt(0)) ? jbsProject + "-" : "") + id)
.issue(issue)
.version(version)
.files(files)

0 comments on commit c0abd82

Please sign in to comment.