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

1828: RFR emails still be sent when PR is in draft state #1484

Closed
wants to merge 2 commits 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -137,7 +137,7 @@ private List<ArchiveItem> generateArchiveItems(List<Email> sentEmails, Repositor

// Check if we're at a revision not previously reported
var baseHash = PullRequestUtils.baseHash(pr, localRepo);
if (!baseHash.equals(lastBase) || !pr.headHash().equals(lastHead)) {
if (!pr.isDraft() && (!baseHash.equals(lastBase) || !pr.headHash().equals(lastHead))) {
if (generated.isEmpty()) {
var first = ArchiveItem.from(pr, localRepo, hostUserToEmailAuthor, issueTracker, issuePrefix, webrevGenerator, webrevNotification, pr.createdAt(), pr.updatedAt(), baseHash, pr.headHash(), subjectPrefix, threadPrefix);
generated.add(first);
Expand Down
Expand Up @@ -3625,6 +3625,36 @@ void notArchiveDraftPR(TestInfo testInfo) throws IOException {
assertEquals(5, archiveContainsCount(archiveFolder.path(), "RFR: 1234: This is a pull request"));
assertEquals(1, archiveContainsCount(archiveFolder.path(), "This is a comment before making"));
assertEquals(1, archiveContainsCount(archiveFolder.path(), "This is a comment after making"));

// Push a new commit before making it as draft.
var secondHash = CheckableRepository.appendAndCommit(localRepo, "Second change", "Change msg");
localRepo.push(secondHash, author.url(), "edit", true);

// Make it as draft again.
pr.makeDraft();

// Push a new commit after making it as draft.
var thirdHash = CheckableRepository.appendAndCommit(localRepo, "Third change", "Change msg");
localRepo.push(thirdHash, author.url(), "edit", true);

// Run another archive pass.
TestBotRunner.runPeriodicItems(mlBot);

// The archive shouldn't contain any new commit.
Repository.materialize(archiveFolder.path(), archive.url(), "master");
assertEquals(5, archiveContainsCount(archiveFolder.path(), "RFR: 1234: This is a pull request"));
assertFalse(archiveContains(archiveFolder.path(), "RFR: 1234: This is a pull request \\[v2\\]"));

// Make it as not draft again.
pr.makeNotDraft();

// Run another archive pass.
TestBotRunner.runPeriodicItems(mlBot);

// The archive should now contain all the comments.
Repository.materialize(archiveFolder.path(), archive.url(), "master");
assertEquals(6, archiveContainsCount(archiveFolder.path(), "RFR: 1234: This is a pull request"));
assertEquals(1, archiveContainsCount(archiveFolder.path(), "RFR: 1234: This is a pull request \\[v2\\]"));
}
}

Expand Down