From 0e9f668e4d3a169ba87ff3080bccd5a367afcd7e Mon Sep 17 00:00:00 2001 From: Daniel Cheng Date: Wed, 19 Oct 2022 17:42:57 +0000 Subject: [PATCH] Only add a CC if it is not already present in the list of CCs. For reasons unknown, the presubmit seems to make multiple passes sometimes; this sometimes results in an email address being inserted into the list of additional CCs multiple times. While this is de-duped by Gerrit, it still generates a fairly spammy message on the client side. Change-Id: I38688462d02ff17f3765c91af326161107027351 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3957428 Reviewed-by: Gavin Mak Commit-Queue: Daniel Cheng --- presubmit_support.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/presubmit_support.py b/presubmit_support.py index 93a9e7373..9dbfd4ba8 100755 --- a/presubmit_support.py +++ b/presubmit_support.py @@ -541,7 +541,8 @@ class OutputApi(object): def AppendCC(self, cc): """Appends a user to cc for this change.""" - self.more_cc.append(cc) + if cc not in self.more_cc: + self.more_cc.append(cc) def PresubmitPromptOrNotify(self, *args, **kwargs): """Warn the user when uploading, but only notify if committing."""