diff --git a/presubmit_support.py b/presubmit_support.py index e48606b1a..26bb6de9c 100755 --- a/presubmit_support.py +++ b/presubmit_support.py @@ -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 diff --git a/tests/presubmit_unittest.py b/tests/presubmit_unittest.py index 359d5f688..6588fcf70 100755 --- a/tests/presubmit_unittest.py +++ b/tests/presubmit_unittest.py @@ -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()