Commit 8a791e7c authored by Edward Lesmes's avatar Edward Lesmes Committed by LUCI CQ

[git-cl][owners] Use new API to suggest batch owners.

Change-Id: I2e2b0aff583e6d9b36261acbef87221e29fe7923
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2565145Reviewed-by: 's avatarJosip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
parent 80cea4f5
......@@ -4803,8 +4803,13 @@ def CMDowners(parser, args):
affected_files = cl.GetAffectedFiles(base_branch)
if options.batch:
db = owners.Database(root, open, os.path)
print('\n'.join(db.reviewers_for(affected_files, author)))
project = cl.GetGerritProject()
branch = cl.GetCommonAncestorWithUpstream()
client = owners_client.DepotToolsClient(
host=cl.GetGerritHost(),
root=settings.GetRoot(),
branch=branch)
print('\n'.join(client.SuggestOwners(project, branch, affected_files)))
return 0
owner_files = [f for f in affected_files if 'OWNERS' in os.path.basename(f)]
......
......@@ -148,7 +148,7 @@ class DepotToolsClient(OwnersClient):
def _GetOriginalOwnersFiles(self):
return {
f: scm.GIT.GetOldContents(self._root, f, self._branch)
f: scm.GIT.GetOldContents(self._root, f, self._branch).splitlines()
for _, f in scm.GIT.CaptureStatus(self._root, self._branch)
if os.path.basename(f) == 'OWNERS'
}
......
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