Commit 9ce03f80 authored by Edward Lesmes's avatar Edward Lesmes Committed by LUCI CQ

presubmit: Add owners_client to presubmit API.

So that presubmit API can use it to check owners
approval.

Change-Id: Ie26c8a83de02b750fd92b4f419fe4d55809e6dbd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2621745Reviewed-by: 's avatarGavin Mak <gavinmak@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
parent c40b2406
......@@ -43,7 +43,8 @@ import gclient_paths # Exposed through the API
import gclient_utils
import git_footers
import gerrit_util
import owners
import owners as owners_db
import owners_client
import owners_finder
import presubmit_canned_checks
import rdb_wrapper
......@@ -651,8 +652,10 @@ class InputApi(object):
# TODO(dpranke): figure out a list of all approved owners for a repo
# in order to be able to handle wildcard OWNERS files?
self.owners_db = owners.Database(change.RepositoryRoot(),
fopen=open, os_path=self.os_path)
self.owners_client = owners_client.DepotToolsClient(
change.RepositoryRoot(), change.UpstreamBranch(), os_path=self.os_path)
self.owners_db = owners_db.Database(
change.RepositoryRoot(), fopen=open, os_path=self.os_path)
self.owners_finder = owners_finder.OwnersFinder
self.verbose = verbose
self.Command = CommandData
......@@ -1096,6 +1099,10 @@ class Change(object):
for action, path in files
]
def UpstreamBranch(self):
"""Returns the upstream branch for the change."""
return self._upstream
def Name(self):
"""Returns the change name."""
return self._name
......
......@@ -165,6 +165,8 @@ index fe3de7b..54ae6e1 100755
self.issue = 0
def RepositoryRoot(self):
return self._root
def UpstreamBranch(self):
return 'upstream'
presubmit._ASKED_FOR_FEEDBACK = False
self.fake_root_dir = self.RootDir()
......
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