Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: presubmit_canned_checks.py

Issue 2337003: Ignore case in tree status check (Closed)
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2010 The Chromium 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 """Generic presubmit checks that can be reused by other presubmit checks.""" 5 """Generic presubmit checks that can be reused by other presubmit checks."""
6 6
7 ### Description checks 7 ### Description checks
8 8
9 def CheckChangeHasTestField(input_api, output_api): 9 def CheckChangeHasTestField(input_api, output_api):
10 """Requires that the changelist have a TEST= field.""" 10 """Requires that the changelist have a TEST= field."""
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 343
344 def CheckTreeIsOpen(input_api, output_api, url, closed): 344 def CheckTreeIsOpen(input_api, output_api, url, closed):
345 """Checks that an url's content doesn't match a regexp that would mean that 345 """Checks that an url's content doesn't match a regexp that would mean that
346 the tree is closed.""" 346 the tree is closed."""
347 if not input_api.is_committing: 347 if not input_api.is_committing:
348 return [] 348 return []
349 try: 349 try:
350 connection = input_api.urllib2.urlopen(url) 350 connection = input_api.urllib2.urlopen(url)
351 status = connection.read() 351 status = connection.read()
352 connection.close() 352 connection.close()
353 if input_api.re.match(closed, status): 353 if input_api.re.match(closed, status, input_api.re.IGNORECASE):
354 long_text = status + '\n' + url 354 long_text = status + '\n' + url
355 return [output_api.PresubmitError('The tree is closed dude!', 355 return [output_api.PresubmitError('The tree is closed dude!',
356 long_text=long_text)] 356 long_text=long_text)]
357 except IOError: 357 except IOError:
358 pass 358 pass
359 return [] 359 return []
360 360
361 361
362 def RunPythonUnitTests(input_api, output_api, unit_tests): 362 def RunPythonUnitTests(input_api, output_api, unit_tests):
363 """Run the unit tests out of process, capture the output and use the result 363 """Run the unit tests out of process, capture the output and use the result
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 pending_builds_len = len(builder.get('pending_builds', [])) 488 pending_builds_len = len(builder.get('pending_builds', []))
489 if pending_builds_len > max_pendings: 489 if pending_builds_len > max_pendings:
490 out.append('%s has %d build(s) pending' % 490 out.append('%s has %d build(s) pending' %
491 (builder_name, pending_builds_len)) 491 (builder_name, pending_builds_len))
492 if out: 492 if out:
493 return [output_api.PresubmitPromptWarning( 493 return [output_api.PresubmitPromptWarning(
494 'Build(s) pending. It is suggested to wait that no more than %d ' 494 'Build(s) pending. It is suggested to wait that no more than %d '
495 'builds are pending.' % max_pendings, 495 'builds are pending.' % max_pendings,
496 long_text='\n'.join(out))] 496 long_text='\n'.join(out))]
497 return [] 497 return []
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698