From 3c86cee33acc7a3641d7c8fdd3944ee44ed507dd Mon Sep 17 00:00:00 2001 From: Dirk Pranke Date: Mon, 23 Jan 2017 22:02:06 -0800 Subject: [PATCH] Revert "Fix OWNERS canned check to avoid duplicate output." This reverts commit 66c50ea1f11a8776355f50800fe7e77e9eea4ce1. Reason for revert: Breaks some OWNERS checks. See https://crbug.com/684270 for details. Original change's description: > Fix OWNERS canned check to avoid duplicate output. > > 1. Update PanProjectChecks() to supply source_filter to CheckOwners(). > This prevents files under e.g. third_party/WebKit being checked both > by the top-level and sub-directory PRESUBMIT rules. > 2. Fix CheckOwners() to list missing-OWNERS only for the sub-directory > it is invoked on, rather than the whole CL. This prevents files under > sub-directories with their own PRESUBMIT rule, within the same repo, > from causing OWNERS to be checked for files outside that directory. > > BUG= > > Reviewed-on: https://chromium-review.googlesource.com/426003 TBR=wez@chromium.org,dcheng@chromium.org BUG=684270 Change-Id: I094818a6fa3e16fbac0d37d2596a40210611ee05 Reviewed-on: https://chromium-review.googlesource.com/431656 Reviewed-by: Dirk Pranke --- presubmit_canned_checks.py | 4 ++-- tests/presubmit_unittest.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py index 37c5143be5..9cd84d6e63 100644 --- a/presubmit_canned_checks.py +++ b/presubmit_canned_checks.py @@ -873,7 +873,7 @@ def CheckOwners(input_api, output_api, source_file_filter=None): output_fn = output_api.PresubmitNotifyResult affected_files = set([f.LocalPath() for f in - input_api.AffectedFiles(file_filter=source_file_filter)]) + input_api.change.AffectedFiles(file_filter=source_file_filter)]) owners_db = input_api.owners_db owner_email, reviewers = GetCodereviewOwnerAndReviewers( @@ -1091,7 +1091,7 @@ def PanProjectChecks(input_api, output_api, if owners_check: snapshot("checking owners") results.extend(input_api.canned_checks.CheckOwners( - input_api, output_api, source_file_filter=sources)) + input_api, output_api, source_file_filter=None)) snapshot("checking long lines") results.extend(input_api.canned_checks.CheckLongLines( diff --git a/tests/presubmit_unittest.py b/tests/presubmit_unittest.py index 2c036e27e4..78319e609d 100755 --- a/tests/presubmit_unittest.py +++ b/tests/presubmit_unittest.py @@ -2195,7 +2195,7 @@ class CannedChecksUnittest(PresubmitTestsBase): if not is_committing or (not tbr and issue): affected_file.LocalPath().AndReturn('foo/xyz.cc') - input_api.AffectedFiles(file_filter=None).AndReturn([affected_file]) + change.AffectedFiles(file_filter=None).AndReturn([affected_file]) if issue and not rietveld_response and not gerrit_response: rietveld_response = { "owner_email": change.author_email,