blob: a40b08d1abe17e02b4ff22a9160306bbac38b923 [file] [log] [blame]
Chris Craikf516a622015-04-01 17:52:39 -07001# Copyright 2015 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
Chris Craik44c28202015-05-12 17:25:16 -07004
5import sys
6
7
8def CheckChange(input_api, output_api):
9 original_sys_path = sys.path
10 try:
11 sys.path += [input_api.PresubmitLocalPath()]
12 from hooks import pre_commit
13 results = pre_commit.GetResults('@{u}')
14 return map(output_api.PresubmitError, results)
15 finally:
16 sys.path = original_sys_path
17
18
Chris Craikf516a622015-04-01 17:52:39 -070019def CheckChangeOnUpload(input_api, output_api):
Chris Craik44c28202015-05-12 17:25:16 -070020 return CheckChange(input_api, output_api)
21
Chris Craikf516a622015-04-01 17:52:39 -070022
23def CheckChangeOnCommit(input_api, output_api):
Chris Craik44c28202015-05-12 17:25:16 -070024 return CheckChange(input_api, output_api)