mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
Add a --ignore-self parameter to "git cl owners"
Sometimes CL author is also listed as OWNERS but want to find a co-owner to review CL. Currently "git cl owners" is unhelpful as it consider the author's ownership as enough. Add a --ignore-self parameter to "git cl owners" that will cause the tool to ignore author's ownership when looking for a reviewer. Bug: none Change-Id: Iba110a465a552cd6befb46c77b2e65f60b663a13 Reviewed-on: https://chromium-review.googlesource.com/c/1459625 Reviewed-by: Dirk Pranke <dpranke@chromium.org> Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
This commit is contained in:
committed by
Commit Bot
parent
70ce8736cb
commit
b1f865dac5
@@ -5098,6 +5098,10 @@ def CMDowners(parser, args):
|
||||
'--ignore-current',
|
||||
action='store_true',
|
||||
help='Ignore the CL\'s current reviewers and start from scratch.')
|
||||
parser.add_option(
|
||||
'--ignore-self',
|
||||
action='store_true',
|
||||
help='Do not consider CL\'s author as an owners.')
|
||||
parser.add_option(
|
||||
'--no-color',
|
||||
action='store_true',
|
||||
@@ -5137,7 +5141,8 @@ def CMDowners(parser, args):
|
||||
[] if options.ignore_current else cl.GetReviewers(),
|
||||
fopen=file, os_path=os.path,
|
||||
disable_color=options.no_color,
|
||||
override_files=change.OriginalOwnersFiles()).run()
|
||||
override_files=change.OriginalOwnersFiles(),
|
||||
ignore_author=options.ignore_self).run()
|
||||
|
||||
|
||||
def BuildGitDiffCmd(diff_type, upstream_commit, args, allow_prefix=False):
|
||||
|
||||
@@ -26,7 +26,8 @@ class OwnersFinder(object):
|
||||
fopen, os_path,
|
||||
email_postfix='@chromium.org',
|
||||
disable_color=False,
|
||||
override_files=None):
|
||||
override_files=None,
|
||||
ignore_author=False):
|
||||
self.email_postfix = email_postfix
|
||||
|
||||
if os.name == 'nt' or disable_color:
|
||||
@@ -46,7 +47,7 @@ class OwnersFinder(object):
|
||||
filtered_files = files
|
||||
|
||||
reviewers = list(reviewers)
|
||||
if author:
|
||||
if author and not ignore_author:
|
||||
reviewers.append(author)
|
||||
|
||||
# Eliminate files that existing reviewers can review.
|
||||
@@ -62,6 +63,8 @@ class OwnersFinder(object):
|
||||
self.db.load_data_needed_for(files)
|
||||
|
||||
self.all_possible_owners = self.db.all_possible_owners(files, None)
|
||||
if author and author in self.all_possible_owners:
|
||||
del self.all_possible_owners[author]
|
||||
|
||||
self.owners_to_files = {}
|
||||
self._map_owners_to_files(files)
|
||||
|
||||
Reference in New Issue
Block a user