Commit 276bab4c authored by Edward Lesmes's avatar Edward Lesmes Committed by LUCI CQ

presubmit: Don't print comments for missing reviewers.

Don't print owners comments when suggesting missing reviewers,
as this won't be supported when using Gerrit API.

Change-Id: I644b2f87b58a3c9ece3aa7d107100f3501bd3071
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2607675
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: 's avatarGavin Mak <gavinmak@google.com>
Reviewed-by: 's avatarJosip Sokcevic <sokcevic@google.com>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
parent b631a88c
......@@ -1176,17 +1176,7 @@ def CheckOwners(
owner_email = owner_email or input_api.change.author_email
finder = input_api.owners_finder(
affected_files,
input_api.change.RepositoryRoot(),
owner_email,
reviewers,
fopen=open,
os_path=input_api.os_path,
email_postfix='',
disable_color=True,
override_files=input_api.change.OriginalOwnersFiles())
missing_files = finder.unreviewed_files
missing_files = owners_db.files_not_covered_by(affected_files, reviewers)
affects_owners = any('OWNERS' in name for name in missing_files)
if input_api.is_committing:
......@@ -1216,15 +1206,9 @@ def CheckOwners(
output_list.append(output_fn('TBR for OWNERS files are ignored.'))
if not input_api.is_committing:
suggested_owners = owners_db.reviewers_for(missing_files, owner_email)
owners_with_comments = []
def RecordComments(text):
owners_with_comments.append(finder.print_indent() + text)
finder.writeln = RecordComments
for owner in suggested_owners:
finder.print_comments(owner)
output_list.append(output_fn('Suggested OWNERS: ' +
'(Use "git-cl owners" to interactively select owners.)\n %s' %
('\n '.join(owners_with_comments))))
('\n '.join(suggested_owners))))
return output_list
if input_api.is_committing and not reviewers:
......
......@@ -2721,14 +2721,9 @@ the current line as well!
fake_db = mock.MagicMock(owners.Database)
fake_db.email_regexp = input_api.re.compile(owners.BASIC_EMAIL_REGEXP)
input_api.owners_db = fake_db
fake_db.files_not_covered_by.return_value = uncovered_files
fake_finder = mock.MagicMock(owners_finder.OwnersFinder)
fake_finder.unreviewed_files = uncovered_files
fake_finder.print_indent = lambda: ''
# pylint: disable=unnecessary-lambda
fake_finder.print_comments = lambda owner: fake_finder.writeln(owner)
input_api.owners_finder = lambda *args, **kwargs: fake_finder
input_api.owners_db = fake_db
input_api.is_committing = is_committing
input_api.tbr = tbr
input_api.dry_run = dry_run
......
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