Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

574: git-info should use info from commit notifications #1011

Closed
wants to merge 6 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -65,7 +65,12 @@ private static boolean getSwitch(String name, Arguments arguments, ReadOnlyRepos

private static String jbsProject(ReadOnlyRepository repo, Hash hash) throws IOException {
var conf = JCheckConfiguration.from(repo, hash).orElseThrow();
return conf.general().jbs().toUpperCase();
var jbsProject = conf.general().jbs();
if (jbsProject != null) {
return jbsProject.toUpperCase();
} else {
return null;
}
}

private static URI getReviewUrl(ReadOnlyRepository repo, Arguments arguments, Hash hash, CommitMessage message) throws IOException {
@@ -74,8 +79,8 @@ private static URI getReviewUrl(ReadOnlyRepository repo, Arguments arguments, Ha
var remoteRepo = ForgeUtils.getHostedRepositoryFor(repoUrl, repo, forge);

var comments = remoteRepo.commitComments(hash);
var reviewComment = comments.stream().filter(c -> c.author().username().equals("openjdk-notifier[bot]")
&& c.body().startsWith("<!-- COMMIT COMMENT NOTIFICATION -->")).findFirst();
var reviewComment = comments.stream().filter(
c -> c.body().startsWith("<!-- COMMIT COMMENT NOTIFICATION -->")).findFirst();

if (reviewComment.isEmpty()) {
return null;
@@ -276,19 +281,21 @@ public static void main(String[] args) throws IOException {
}
if (showIssues) {
var project = jbsProject(repo, hash);
var uri = JBS + "/browse/" + project + "-";
var issues = message.issues();
if (issues.size() > 1) {
if (useDecoration) {
System.out.println("Issues:");
}
var decoration = useDecoration ? "- " : "";
for (var issue : issues) {
System.out.println(decoration + uri + issue.shortId());
if (project != null) {
var uri = JBS + "/browse/" + project + "-";
var issues = message.issues();
if (issues.size() > 1) {
if (useDecoration) {
System.out.println("Issues:");
}
var decoration = useDecoration ? "- " : "";
for (var issue : issues) {
System.out.println(decoration + uri + issue.shortId());
}
} else if (issues.size() == 1) {
var decoration = useDecoration ? "Issue: " : "";
System.out.println(decoration + uri + issues.get(0).shortId());
}
} else if (issues.size() == 1) {
var decoration = useDecoration ? "Issue: " : "";
System.out.println(decoration + uri + issues.get(0).shortId());
}
}
}