[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/+/2565145
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
diff --git a/git_cl.py b/git_cl.py
index b38dd74..bca2656 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -4803,8 +4803,13 @@
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)]