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/+/2621745
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
changes/45/2621745/5
Edward Lesmes 4 years ago committed by LUCI CQ
parent c40b2406de
commit 9ce03f80a4

@ -43,7 +43,8 @@ import gclient_paths # Exposed through the API
import gclient_utils import gclient_utils
import git_footers import git_footers
import gerrit_util import gerrit_util
import owners import owners as owners_db
import owners_client
import owners_finder import owners_finder
import presubmit_canned_checks import presubmit_canned_checks
import rdb_wrapper import rdb_wrapper
@ -651,8 +652,10 @@ class InputApi(object):
# TODO(dpranke): figure out a list of all approved owners for a repo # TODO(dpranke): figure out a list of all approved owners for a repo
# in order to be able to handle wildcard OWNERS files? # in order to be able to handle wildcard OWNERS files?
self.owners_db = owners.Database(change.RepositoryRoot(), self.owners_client = owners_client.DepotToolsClient(
fopen=open, os_path=self.os_path) 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.owners_finder = owners_finder.OwnersFinder
self.verbose = verbose self.verbose = verbose
self.Command = CommandData self.Command = CommandData
@ -1096,6 +1099,10 @@ class Change(object):
for action, path in files for action, path in files
] ]
def UpstreamBranch(self):
"""Returns the upstream branch for the change."""
return self._upstream
def Name(self): def Name(self):
"""Returns the change name.""" """Returns the change name."""
return self._name return self._name

@ -165,6 +165,8 @@ index fe3de7b..54ae6e1 100755
self.issue = 0 self.issue = 0
def RepositoryRoot(self): def RepositoryRoot(self):
return self._root return self._root
def UpstreamBranch(self):
return 'upstream'
presubmit._ASKED_FOR_FEEDBACK = False presubmit._ASKED_FOR_FEEDBACK = False
self.fake_root_dir = self.RootDir() self.fake_root_dir = self.RootDir()

Loading…
Cancel
Save