Commit 3c57b27a authored by Edward Lesmes's avatar Edward Lesmes Committed by LUCI CQ

Revert "presubmit: Don't print comments for missing reviewers."

This reverts commit 276bab4c.

Reason for revert:
Possible cause of crbug.com/1163731

Original change's description:
> 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: Gavin Mak <gavinmak@google.com>
> Reviewed-by: Josip Sokcevic <sokcevic@google.com>
> Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>

TBR=ehmaldonado@chromium.org,gavinmak@google.com,infra-scoped@luci-project-accounts.iam.gserviceaccount.com,sokcevic@google.com

Bug: 1163731
Change-Id: I0b3d0f352e5483e754f6b790f70a9278df4eb3e2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2613924Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
parent d48aa437
......@@ -1176,7 +1176,17 @@ def CheckOwners(
owner_email = owner_email or input_api.change.author_email
missing_files = owners_db.files_not_covered_by(affected_files, reviewers)
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
affects_owners = any('OWNERS' in name for name in missing_files)
if input_api.is_committing:
......@@ -1206,9 +1216,15 @@ 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(suggested_owners))))
('\n '.join(owners_with_comments))))
return output_list
if input_api.is_committing and not reviewers:
......
......@@ -2721,9 +2721,14 @@ the current line as well!
fake_db = mock.MagicMock(owners.Database)
fake_db.email_regexp = input_api.re.compile(owners.BASIC_EMAIL_REGEXP)
fake_db.files_not_covered_by.return_value = uncovered_files
input_api.owners_db = fake_db
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.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