From 9d66f480c8212f12c5d6df56bf4509bd2151990a Mon Sep 17 00:00:00 2001 From: "dpranke@chromium.org" Date: Fri, 18 Jan 2013 02:57:11 +0000 Subject: [PATCH] handle OWNERS suggestions where anyone can approve better. previously we would return "*" as one of the suggested owners when a CL included a file that anyone could approve. If the change had other owners, the "*" was unnecessary, and if the change only included wildcard-owned files, "*" isn't very helpful, so I've changed the text slightly. R=maruel@chromium.org BUG=169168 Review URL: https://chromiumcodereview.appspot.com/11867016 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@177575 0039d316-1c4b-4281-b951-d872f2087c98 --- owners.py | 8 +++++++- tests/owners_unittest.py | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/owners.py b/owners.py index d56c36f38..8007e171c 100644 --- a/owners.py +++ b/owners.py @@ -121,7 +121,13 @@ class Database(object): files is a sequence of paths relative to (and under) self.root.""" self._check_paths(files) self._load_data_needed_for(files) - return self._covering_set_of_owners_for(files) + suggested_owners = self._covering_set_of_owners_for(files) + if EVERYONE in suggested_owners: + if len(suggested_owners) > 1: + suggested_owners.remove(EVERYONE) + else: + suggested_owners = set(['']) + return suggested_owners # TODO(dpranke): rename to objects_not_covered_by def directories_not_covered_by(self, files, reviewers): diff --git a/tests/owners_unittest.py b/tests/owners_unittest.py index 552fa78dc..20491ab4d 100755 --- a/tests/owners_unittest.py +++ b/tests/owners_unittest.py @@ -259,7 +259,8 @@ class ReviewersForTest(_BaseTestCase): self.assertRaises(AssertionError, db.reviewers_for, ['/OWNERS']) def test_reviewers_for__wildcard_dir(self): - self.assert_reviewers_for(['DEPS'], [owners.EVERYONE]) + self.assert_reviewers_for(['DEPS'], ['']) + self.assert_reviewers_for(['DEPS', 'chrome/gpu/gpu_channel.h'], [ken]) def test_reviewers_for__one_owner(self): self.assert_reviewers_for([