presubmit: Don't skip OWNERS check when Bot-Commit+1 is present.
Change-Id: I17b07796a86c5214e13a0058428889c1bb2b850d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2774080
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Jason Clinton <jclinton@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py
index 16c1497..d4714e5 100644
--- a/presubmit_canned_checks.py
+++ b/presubmit_canned_checks.py
@@ -1127,17 +1127,12 @@
def CheckOwners(
input_api, output_api, source_file_filter=None, allow_tbr=True):
- if input_api.change.issue:
- # Skip OWNERS check when Bot-Commit label is approved. This label is
- # intended for commits made by trusted bots that don't require review nor
- # owners approval.
- if input_api.gerrit.IsBotCommitApproved(input_api.change.issue):
- return []
- # Skip OWNERS check when Owners-Override label is approved. This is intended
- # for global owners, trusted bots, and on-call sheriffs. Review is still
- # required for these changes.
- if input_api.gerrit.IsOwnersOverrideApproved(input_api.change.issue):
- return []
+ # Skip OWNERS check when Owners-Override label is approved. This is intended
+ # for global owners, trusted bots, and on-call sheriffs. Review is still
+ # required for these changes.
+ if (input_api.change.issue
+ and input_api.gerrit.IsOwnersOverrideApproved(input_api.change.issue)):
+ return []
# Ignore tbr if not allowed for this repo.
tbr = input_api.tbr and allow_tbr
diff --git a/presubmit_support.py b/presubmit_support.py
index 3a05c4b..c53ed8f 100755
--- a/presubmit_support.py
+++ b/presubmit_support.py
@@ -446,9 +446,6 @@
return [v for v in label_info.get('all', [])
if v.get('value', 0) == max_value]
- def IsBotCommitApproved(self, issue):
- return bool(self._GetApproversForLabel(issue, 'Bot-Commit'))
-
def IsOwnersOverrideApproved(self, issue):
return bool(self._GetApproversForLabel(issue, 'Owners-Override'))
diff --git a/tests/presubmit_unittest.py b/tests/presubmit_unittest.py
index fc4e1df..739a2e3 100755
--- a/tests/presubmit_unittest.py
+++ b/tests/presubmit_unittest.py
@@ -2795,37 +2795,6 @@
response=response,
expected_output='')
- def testCannedCheckOwners_BotCommit(self):
- response = {
- "owner": {"email": "john@example.com"},
- "labels": {"Bot-Commit": {
- u'all': [
- {
- u'email': u'bot@example.com',
- u'value': 1
- },
- ],
- u'approved': {u'email': u'bot@example.org'},
- u'default_value': 0,
- u'values': {u' 0': u'No score',
- u'+1': u'Looks good to me'},
- }},
- "reviewers": {"REVIEWER": [{u'email': u'bot@example.com'}]},
- }
- self.AssertOwnersWorks(
- approvers=set(),
- modified_files={'foo/xyz.cc': ['john@example.com']},
- response=response,
- is_committing=True,
- expected_output='')
-
- self.AssertOwnersWorks(
- approvers=set(),
- modified_files={'foo/xyz.cc': ['john@example.com']},
- is_committing=False,
- response=response,
- expected_output='')
-
def testCannedCheckOwners_OwnersOverride(self):
response = {
"owner": {"email": "john@example.com"},