Commit c900fe57 authored by Edward Lesmes's avatar Edward Lesmes Committed by LUCI CQ

presubmit: Also skip owners check on upload if code-owners is enabled.

Change-Id: I6f136321750b4e9f2514f04a6f357272d35e9b4f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2775715Reviewed-by: 's avatarJosip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
parent 392c407b
......@@ -1136,18 +1136,9 @@ def CheckOwners(
and input_api.gerrit.IsOwnersOverrideApproved(input_api.change.issue)):
return []
code_owners_enabled = False
if input_api.gerrit and input_api.gerrit.IsCodeOwnersEnabledOnRepo():
code_owners_enabled = True
# Skip OWNERS check on commit if code-owners plugin is enabled, as owners
# enforcement is done by the plugin.
if input_api.is_committing and code_owners_enabled:
return []
# Ignore tbr if the code-owners plugin is enabled on this repo.
tbr = not code_owners_enabled and input_api.tbr
affected_files = set([f.LocalPath() for f in
input_api.change.AffectedFiles(file_filter=source_file_filter)])
owner_email, reviewers = GetCodereviewOwnerAndReviewers(
......@@ -1163,7 +1154,7 @@ def CheckOwners(
affects_owners = any('OWNERS' in name for name in missing_files)
if input_api.is_committing:
if tbr and not affects_owners:
if input_api.tbr and not affects_owners:
return [output_api.PresubmitNotifyResult(
'--tbr was specified, skipping OWNERS check')]
needed = 'LGTM from an OWNER'
......@@ -1185,7 +1176,7 @@ def CheckOwners(
output_list = [
output_fn('Missing %s for these files:\n %s' %
(needed, '\n '.join(sorted(missing_files))))]
if tbr and affects_owners:
if input_api.tbr and affects_owners:
output_list.append(output_fn('TBR for OWNERS files are ignored.'))
if not input_api.is_committing:
suggested_owners = input_api.owners_client.SuggestOwners(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment