| OLD | NEW |
| 1 # Copyright 2012 the V8 project authors. All rights reserved. | 1 # Copyright 2012 the V8 project authors. All rights reserved. |
| 2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
| 3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
| 4 # met: | 4 # met: |
| 5 # | 5 # |
| 6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
| 9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
| 10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 | 60 |
| 61 def _SkipTreeCheck(input_api, output_api): | 61 def _SkipTreeCheck(input_api, output_api): |
| 62 """Check the env var whether we want to skip tree check. | 62 """Check the env var whether we want to skip tree check. |
| 63 Only skip if src/version.cc has been updated.""" | 63 Only skip if src/version.cc has been updated.""" |
| 64 src_version = 'src/version.cc' | 64 src_version = 'src/version.cc' |
| 65 FilterFile = lambda file: file.LocalPath() == src_version | 65 FilterFile = lambda file: file.LocalPath() == src_version |
| 66 if not input_api.AffectedSourceFiles( | 66 if not input_api.AffectedSourceFiles( |
| 67 lambda file: file.LocalPath() == src_version): | 67 lambda file: file.LocalPath() == src_version): |
| 68 return False | 68 return False |
| 69 if input_api.environ.get('PRESUBMIT_TREE_CHECK') == 'skip': |
| 70 print "Skip tree check requested via environment variable." |
| 69 return input_api.environ.get('PRESUBMIT_TREE_CHECK') == 'skip' | 71 return input_api.environ.get('PRESUBMIT_TREE_CHECK') == 'skip' |
| 70 | 72 |
| 71 | 73 |
| 72 def _CheckChangeLogFlag(input_api, output_api): | 74 def _CheckChangeLogFlag(input_api, output_api): |
| 73 """Checks usage of LOG= flag in the commit message.""" | 75 """Checks usage of LOG= flag in the commit message.""" |
| 74 results = [] | 76 results = [] |
| 75 if input_api.change.BUG and not 'LOG' in input_api.change.tags: | 77 if input_api.change.BUG and not 'LOG' in input_api.change.tags: |
| 76 results.append(output_api.PresubmitError( | 78 results.append(output_api.PresubmitError( |
| 77 'An issue reference (BUG=) requires a change log flag (LOG=). ' | 79 'An issue reference (BUG=) requires a change log flag (LOG=). ' |
| 78 'Use LOG=Y for including this commit message in the change log. ' | 80 'Use LOG=Y for including this commit message in the change log. ' |
| 79 'Use LOG=N or leave blank otherwise.')) | 81 'Use LOG=N or leave blank otherwise.')) |
| 80 return results | 82 return results |
| 81 | 83 |
| 82 | 84 |
| 83 def CheckChangeOnUpload(input_api, output_api): | 85 def CheckChangeOnUpload(input_api, output_api): |
| 84 results = [] | 86 results = [] |
| 85 results.extend(_CommonChecks(input_api, output_api)) | 87 results.extend(_CommonChecks(input_api, output_api)) |
| 86 results.extend(_CheckChangeLogFlag(input_api, output_api)) | 88 results.extend(_CheckChangeLogFlag(input_api, output_api)) |
| 87 return results | 89 return results |
| 88 | 90 |
| 89 | 91 |
| 90 def CheckChangeOnCommit(input_api, output_api): | 92 def CheckChangeOnCommit(input_api, output_api): |
| 91 results = [] | 93 results = [] |
| 92 results.extend(_CommonChecks(input_api, output_api)) | 94 results.extend(_CommonChecks(input_api, output_api)) |
| 93 results.extend(_CheckChangeLogFlag(input_api, output_api)) | 95 results.extend(_CheckChangeLogFlag(input_api, output_api)) |
| 94 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 96 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
| 95 input_api, output_api)) | 97 input_api, output_api)) |
| 96 if not _SkipTreeCheck(input_api, output_api): | 98 if not _SkipTreeCheck(input_api, output_api): |
| 99 print "Checking if tree is open." |
| 97 results.extend(input_api.canned_checks.CheckTreeIsOpen( | 100 results.extend(input_api.canned_checks.CheckTreeIsOpen( |
| 98 input_api, output_api, | 101 input_api, output_api, |
| 99 json_url='http://v8-status.appspot.com/current?format=json')) | 102 json_url='http://v8-status.appspot.com/current?format=json')) |
| 100 return results | 103 return results |
| OLD | NEW |