| OLD | NEW |
| 1 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 1 # Copyright (c) 2012 The Native Client Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 # Documentation on PRESUBMIT.py can be found at: | 5 # Documentation on PRESUBMIT.py can be found at: |
| 6 # http://www.chromium.org/developers/how-tos/depottools/presubmit-scripts | 6 # http://www.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| 7 | 7 |
| 8 EXCLUDE_PROJECT_CHECKS_DIRS = [ '.' ] | 8 EXCLUDE_PROJECT_CHECKS_DIRS = [ '.' ] |
| 9 | 9 |
| 10 import subprocess | 10 import subprocess |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 return None | 29 return None |
| 30 print 'Warning: presubmit check could not determine local git branch' | 30 print 'Warning: presubmit check could not determine local git branch' |
| 31 return None | 31 return None |
| 32 | 32 |
| 33 def _CommonChecks(input_api, output_api): | 33 def _CommonChecks(input_api, output_api): |
| 34 """Checks for both upload and commit.""" | 34 """Checks for both upload and commit.""" |
| 35 results = [] | 35 results = [] |
| 36 results.extend(input_api.canned_checks.PanProjectChecks( | 36 results.extend(input_api.canned_checks.PanProjectChecks( |
| 37 input_api, output_api, project_name='Native Client', | 37 input_api, output_api, project_name='Native Client', |
| 38 excluded_paths=tuple(EXCLUDE_PROJECT_CHECKS_DIRS))) | 38 excluded_paths=tuple(EXCLUDE_PROJECT_CHECKS_DIRS))) |
| 39 branch_warning = CheckGitBranch() | |
| 40 if branch_warning: | |
| 41 results.append(output_api.PresubmitPromptWarning(branch_warning)) | |
| 42 return results | 39 return results |
| 43 | 40 |
| 44 def CheckChangeOnUpload(input_api, output_api): | 41 def CheckChangeOnUpload(input_api, output_api): |
| 45 """Verifies all changes in all files. | 42 """Verifies all changes in all files. |
| 46 Args: | 43 Args: |
| 47 input_api: the limited set of input modules allowed in presubmit. | 44 input_api: the limited set of input modules allowed in presubmit. |
| 48 output_api: the limited set of output modules allowed in presubmit. | 45 output_api: the limited set of output modules allowed in presubmit. |
| 49 """ | 46 """ |
| 50 report = [] | 47 report = [] |
| 51 report.extend(_CommonChecks(input_api, output_api)) | 48 report.extend(_CommonChecks(input_api, output_api)) |
| 49 branch_warning = CheckGitBranch() |
| 50 if branch_warning: |
| 51 report.append(output_api.PresubmitPromptWarning(branch_warning)) |
| 52 return report | 52 return report |
| 53 | 53 |
| 54 def CheckChangeOnCommit(input_api, output_api): | 54 def CheckChangeOnCommit(input_api, output_api): |
| 55 """Verifies all changes in all files and verifies that the | 55 """Verifies all changes in all files and verifies that the |
| 56 tree is open and can accept a commit. | 56 tree is open and can accept a commit. |
| 57 Args: | 57 Args: |
| 58 input_api: the limited set of input modules allowed in presubmit. | 58 input_api: the limited set of input modules allowed in presubmit. |
| 59 output_api: the limited set of output modules allowed in presubmit. | 59 output_api: the limited set of output modules allowed in presubmit. |
| 60 """ | 60 """ |
| 61 report = [] | 61 report = [] |
| 62 report.extend(CheckChangeOnUpload(input_api, output_api)) | 62 report.extend(_CommonChecks(input_api, output_api)) |
| 63 return report | 63 return report |
| 64 | 64 |
| 65 def GetPreferredTrySlaves(project, change): | 65 def GetPreferredTrySlaves(project, change): |
| 66 return [] | 66 return [] |
| OLD | NEW |