Skip to content

Commit 2d0d92a

Browse files
committed
Mail Archive: flag stale commit comments
During mail archive handling, flag commit comments as outdated if the commit has been superceded in the patch. Signed-off-by: Chris. Webster <chris@webstech.net>
1 parent 33bacb1 commit 2d0d92a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/mail-archive-helper.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { GitHubGlue } from "./github-glue";
66
import { IMailMetadata } from "./mail-metadata";
77
import { IPatchSeriesMetadata } from "./patch-series-metadata";
88
import { IConfig, getConfig } from "./project-config";
9+
import { getPullRequestKey } from "./pullRequestKey";
910
import { IParsedMBox, parseMBox, parseMBoxMessageIDAndReferences } from "./send-mail";
1011
import { SousChef } from "./sous-chef";
1112

@@ -178,6 +179,7 @@ export class MailArchiveGitHelper {
178179
} wrote ([reply to this](${replyToThisURL})):\n\n`;
179180
const comment = MailArchiveGitHelper.mbox2markdown(parsedMbox);
180181
const fullComment = header + comment;
182+
const prKey = getPullRequestKey(pullRequestURL);
181183

182184
if (issueCommentId) {
183185
await this.githubGlue.addPRCommentReply(pullRequestURL, issueCommentId, fullComment);
@@ -187,7 +189,9 @@ export class MailArchiveGitHelper {
187189
this.gggNotes.workDir, fullComment, firstPatchLine);
188190
issueCommentId = result.id;
189191
} catch (error) {
190-
const regarding = `${header.slice(0,-3)}, regarding ${originalCommit}:\n\n`;
192+
const commits = await this.githubGlue.getPRCommits(prKey.owner, prKey.pull_number);
193+
const regarding = `${header.slice(0,-3)}, regarding ${originalCommit}${
194+
commits.find(e => e.commit === originalCommit) ? "" : " (outdated)"}:\n\n`;
191195
await this.githubGlue.addPRComment(pullRequestURL, regarding + comment);
192196
originalCommit = undefined;
193197
}

0 commit comments

Comments
 (0)