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

Post the incremental webrev url in the PR comment #367

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static ArchiveItem from(PullRequest pr, Repository localRepo, URI issueTracker,
() -> ArchiveMessages.composeConversation(pr, base, head),
() -> {
var fullWebrev = webrevGenerator.generate(base, head, "00");
webrevNotification.notify(fullWebrev, 0, true);
webrevNotification.notify(0, fullWebrev, null);
return ArchiveMessages.composeConversationFooter(pr, issueTracker, issuePrefix, localRepo, fullWebrev, base, head);
});
}
Expand All @@ -54,10 +54,9 @@ static ArchiveItem from(PullRequest pr, Repository localRepo, WebrevStorage.Webr
() -> ArchiveMessages.composeRevision(pr, localRepo, base, head, lastBase, lastHead),
() -> {
var fullWebrev = webrevGenerator.generate(base, head, String.format("%02d", index));
webrevNotification.notify(fullWebrev, index, true);
if (lastBase.equals(base)) {
var incrementalWebrev = webrevGenerator.generate(lastHead, head, String.format("%02d-%02d", index - 1, index));
webrevNotification.notify(incrementalWebrev, index, false);
webrevNotification.notify(index, fullWebrev, incrementalWebrev);
return ArchiveMessages.composeIncrementalFooter(pr, localRepo, fullWebrev, incrementalWebrev, head, lastHead);
} else {
// It may be possible to auto-rebase the last head onto the new base to get an incremental webrev
Expand All @@ -66,10 +65,11 @@ static ArchiveItem from(PullRequest pr, Repository localRepo, WebrevStorage.Webr
localRepo.rebase(base, "duke", "duke@openjdk.org");
var rebasedLastHead = localRepo.head();
var incrementalWebrev = webrevGenerator.generate(rebasedLastHead, head, String.format("%02d-%02d", index - 1, index));
webrevNotification.notify(incrementalWebrev, index, false);
webrevNotification.notify(index, fullWebrev, incrementalWebrev);
return ArchiveMessages.composeIncrementalFooter(pr, localRepo, fullWebrev, incrementalWebrev, head, lastHead);
} catch (IOException e) {
// If it doesn't work out we just post a full webrev
webrevNotification.notify(index, fullWebrev, null);
return ArchiveMessages.composeRebaseFooter(pr, localRepo, fullWebrev, base, head);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public void run(Path scratchPath) {

var webrevGenerator = bot.webrevStorage().generator(pr, localRepo, webrevPath);
var newMails = archiver.generateNewEmails(sentMails, localRepo, bot.issueTracker(), jbs.toUpperCase(), webrevGenerator,
(uri, index, isFull) -> updateWebrevComment(comments, index, uri, null),
(index, full, inc) -> updateWebrevComment(comments, index, full, inc),
user -> getAuthorAddress(census, user),
user -> getAuthorUserName(census, user),
user -> getAuthorRole(census, user));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@

@FunctionalInterface
interface WebrevNotification {
void notify(URI uri, int index, boolean isFull);
void notify(int index, URI full, URI incremental);
}
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,8 @@ void incrementalChanges(TestInfo testInfo) throws IOException {
var webrevComments = comments.stream()
.filter(comment -> comment.author().equals(author.forge().currentUser()))
.filter(comment -> comment.body().contains("webrev"))
.filter(comment -> comment.body().contains("Full"))
.filter(comment -> comment.body().contains("Incremental"))
.filter(comment -> comment.body().contains(nextHash.hex()))
.filter(comment -> comment.body().contains(editHash.hex()))
.collect(Collectors.toList());
Expand Down