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

964: Should only consider Fixed bugs for hgupdate-sync #1115

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
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
@@ -43,9 +43,9 @@ void removeLabelForApprovedCSR(TestInfo testInfo) throws IOException {
var issues = credentials.getIssueProject();
var issue = issues.createIssue("This is an issue", List.of(), Map.of());

var csr = issues.createIssue("This is an approved CSR", List.of(), Map.of("resolution",
JSON.object().put("name", "Approved")));
var csr = issues.createIssue("This is an approved CSR", List.of(), Map.of());
csr.setState(Issue.State.CLOSED);
csr.setProperty("resolution", JSON.object().put("name", "Approved"));
issue.addLink(Link.create(csr, "csr for").build());

var bot = new CSRBot(repo, issues);
@@ -105,9 +105,9 @@ void alreadyApprovedCSR(TestInfo testInfo) throws IOException {
var issues = credentials.getIssueProject();
var issue = issues.createIssue("This is an issue", List.of(), Map.of());

var csr = issues.createIssue("This is an approved CSR", List.of(), Map.of("resolution",
JSON.object().put("name", "Approved")));
var csr = issues.createIssue("This is an approved CSR", List.of(), Map.of());
csr.setState(Issue.State.CLOSED);
csr.setProperty("resolution", JSON.object().put("name", "Approved"));
issue.addLink(Link.create(csr, "csr for").build());

var censusBuilder = credentials.getCensusBuilder()
@@ -192,14 +192,34 @@ public static Optional<Issue> findIssue(Issue primary, JdkVersion fixVersion) {
return Optional.empty();
}

public static List<Issue> findBackports(Issue primary, boolean resolvedOnly) {
private static boolean isFixed(Issue issue) {
if (issue.state() == Issue.State.OPEN) {
return false;
}
var resolution = issue.properties().get("resolution");
if (resolution == null || resolution.isNull()) {
return false;
}
var name = resolution.get("name");
if (name == null || name.isNull()) {
return false;
}

if (!name.asString().equals("Fixed")) {
return false;
}

return true;
}

public static List<Issue> findBackports(Issue primary, boolean fixedOnly) {
var links = primary.links();
return links.stream()
.filter(l -> l.issue().isPresent())
.filter(l -> l.relationship().isPresent())
.filter(l -> l.relationship().get().equals("backported by"))
.map(l -> l.issue().get())
.filter(i -> !resolvedOnly || (i.state() != Issue.State.OPEN))
.filter(i -> !fixedOnly || isFixed(i))
.filter(i -> i.properties().containsKey("issuetype"))
.filter(i -> i.properties().get("issuetype").asString().equals("Backport"))
.collect(Collectors.toList());
@@ -185,6 +185,10 @@ private static class BackportManager {
private void setState(Issue issue, String version) {
if (version.endsWith("#open")) {
version = version.substring(0, version.length() - 5);
} else if (version.endsWith("#wontfix")) {
version = version.substring(0, version.length() - 8);
issue.setState(Issue.State.RESOLVED);
issue.setProperty("resolution", JSON.object().put("name", JSON.of("Won't Fix")));
} else {
issue.setState(Issue.State.RESOLVED);
}
@@ -754,4 +758,15 @@ void sampleTest24(TestInfo testInfo) throws IOException {
backports.assertLabeled();
}
}

@Test
void wontFix(TestInfo testInfo) throws IOException {
try (var credentials = new HostCredentials(testInfo)) {
var backports = new BackportManager(credentials, "14");
backports.assertLabeled();

backports.addBackports("15", "13.0.7", "11.0.12-oracle", "11.0.11-oracle#wontfix", "11.0.10");
backports.assertLabeled("15");
}
}
}
@@ -24,7 +24,7 @@

import org.openjdk.skara.host.HostUser;
import org.openjdk.skara.issuetracker.*;
import org.openjdk.skara.json.JSONValue;
import org.openjdk.skara.json.*;
import org.openjdk.skara.network.URIBuilder;

import java.net.URI;
@@ -150,6 +150,7 @@ public void setState(State state) {
data.state = state;
data.lastUpdate = ZonedDateTime.now();
data.closedBy = user;
data.properties.put("resolution", JSON.object().put("name", JSON.of("Fixed")));
}

@Override