From c3c15a1f6b7113ab55326d037f254940a75b8a7b Mon Sep 17 00:00:00 2001 From: Edward Lesmes Date: Tue, 19 Jan 2021 20:19:14 +0000 Subject: [PATCH] owners_finder: Don't print comments for owners This feature will not be supported when using Gerrit Code-Owners plugin. Change-Id: I7ad0d5bf004ba39818e57fc00e40592a44d1d11f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2638140 Auto-Submit: Edward Lesmes Commit-Queue: Gavin Mak Reviewed-by: Gavin Mak --- owners_finder.py | 29 ++--------------------------- tests/owners_finder_test.py | 17 ----------------- 2 files changed, 2 insertions(+), 44 deletions(-) diff --git a/owners_finder.py b/owners_finder.py index e421b763e..99b56bedf 100644 --- a/owners_finder.py +++ b/owners_finder.py @@ -82,7 +82,6 @@ class OwnersFinder(object): self.all_possible_owners, files) self.original_files_to_owners = copy.deepcopy(self.files_to_owners) - self.comments = self.db.comments # This is the queue that will be shown in the interactive questions. # It is initially sorted by the score in descending order. In the @@ -220,30 +219,6 @@ class OwnersFinder(object): continues = True break - def print_comments(self, owner): - if owner not in self.comments: - self.writeln(self.bold_name(owner)) - else: - self.writeln(self.bold_name(owner) + ' is commented as:') - self.indent() - if owners_module.GLOBAL_STATUS in self.comments[owner]: - self.writeln( - self.greyed(self.comments[owner][owners_module.GLOBAL_STATUS]) + - ' (global status)') - if len(self.comments[owner]) == 1: - self.unindent() - return - for path in self.comments[owner]: - if path == owners_module.GLOBAL_STATUS: - continue - elif len(self.comments[owner][path]) > 0: - self.writeln(self.greyed(self.comments[owner][path]) + - ' (at ' + self.bold(path or '') + ')') - else: - self.writeln(self.greyed('[No comment] ') + ' (at ' + - self.bold(path or '') + ')') - self.unindent() - def print_file_info(self, file_name, except_owner=''): if file_name not in self.unreviewed_files: self.writeln(self.greyed(file_name + @@ -277,7 +252,7 @@ class OwnersFinder(object): def print_owned_files_for(self, owner): # Print owned files - self.print_comments(owner) + self.writeln(self.bold_name(owner)) self.writeln(self.bold_name(owner) + ' owns ' + str(len(self.owners_to_files[owner])) + ' file(s):') self.indent() @@ -291,7 +266,7 @@ class OwnersFinder(object): len(self.selected_owners)) > 3: for ow in owners_queue: if ow not in self.deselected_owners and ow not in self.selected_owners: - self.print_comments(ow) + self.writeln(self.bold_name(ow)) else: for ow in owners_queue: if ow not in self.deselected_owners and ow not in self.selected_owners: diff --git a/tests/owners_finder_test.py b/tests/owners_finder_test.py index 7d9b95237..457564761 100755 --- a/tests/owners_finder_test.py +++ b/tests/owners_finder_test.py @@ -272,23 +272,6 @@ class OwnersFinderTests(_BaseTestCase): ['chrome/renderer/gpu/gpu_channel_host.h', [ben, brett, ken, peter, tom]]) - def test_print_comments(self): - finder = self.defaultFinder() - finder.print_comments(darin) - self.assertEqual(finder.output, - [darin + ' is commented as:', ['foo (at content)']]) - - def test_print_global_comments(self): - finder = self.ownersFinder(['content/common/common.cc']) - finder.print_comments(jochen) - self.assertEqual(finder.output, - [jochen + ' is commented as:', ['bar (global status)']]) - - finder = self.ownersFinder(['content/foo/foo.cc']) - finder.print_comments(jochen) - self.assertEqual(finder.output, - [jochen + ' is commented as:', ['bar (global status)', - 'foo (at content/foo)']]) if __name__ == '__main__': unittest.main()