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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 def _SkipTreeCheck(input_api, output_api): | 235 def _SkipTreeCheck(input_api, output_api): |
236 """Check the env var whether we want to skip tree check. | 236 """Check the env var whether we want to skip tree check. |
237 Only skip if include/v8-version.h has been updated.""" | 237 Only skip if include/v8-version.h has been updated.""" |
238 src_version = 'include/v8-version.h' | 238 src_version = 'include/v8-version.h' |
239 if not input_api.AffectedSourceFiles( | 239 if not input_api.AffectedSourceFiles( |
240 lambda file: file.LocalPath() == src_version): | 240 lambda file: file.LocalPath() == src_version): |
241 return False | 241 return False |
242 return input_api.environ.get('PRESUBMIT_TREE_CHECK') == 'skip' | 242 return input_api.environ.get('PRESUBMIT_TREE_CHECK') == 'skip' |
243 | 243 |
244 | 244 |
245 def _CheckChangeLogFlag(input_api, output_api, warn): | |
246 """Checks usage of LOG= flag in the commit message.""" | |
247 results = [] | |
248 if (input_api.change.BUG and input_api.change.BUG != 'none' and | |
249 not 'LOG' in input_api.change.tags): | |
250 text = ('An issue reference (BUG=) requires a change log flag (LOG=). ' | |
251 'Use LOG=Y for including this commit message in the change log. ' | |
252 'Use LOG=N or leave blank otherwise.') | |
253 if warn: | |
254 results.append(output_api.PresubmitPromptWarning(text)) | |
255 else: | |
256 results.append(output_api.PresubmitError(text)) | |
257 return results | |
258 | |
259 | |
260 def CheckChangeOnUpload(input_api, output_api): | 245 def CheckChangeOnUpload(input_api, output_api): |
261 results = [] | 246 results = [] |
262 results.extend(_CommonChecks(input_api, output_api)) | 247 results.extend(_CommonChecks(input_api, output_api)) |
263 results.extend(_CheckChangeLogFlag(input_api, output_api, True)) | |
264 return results | 248 return results |
265 | 249 |
266 | 250 |
267 def CheckChangeOnCommit(input_api, output_api): | 251 def CheckChangeOnCommit(input_api, output_api): |
268 results = [] | 252 results = [] |
269 results.extend(_CommonChecks(input_api, output_api)) | 253 results.extend(_CommonChecks(input_api, output_api)) |
270 results.extend(_CheckChangeLogFlag(input_api, output_api, False)) | |
271 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 254 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
272 input_api, output_api)) | 255 input_api, output_api)) |
273 if not _SkipTreeCheck(input_api, output_api): | 256 if not _SkipTreeCheck(input_api, output_api): |
274 results.extend(input_api.canned_checks.CheckTreeIsOpen( | 257 results.extend(input_api.canned_checks.CheckTreeIsOpen( |
275 input_api, output_api, | 258 input_api, output_api, |
276 json_url='http://v8-status.appspot.com/current?format=json')) | 259 json_url='http://v8-status.appspot.com/current?format=json')) |
277 return results | 260 return results |
OLD | NEW |