OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Generic presubmit checks that can be reused by other presubmit checks.""" | 6 """Generic presubmit checks that can be reused by other presubmit checks.""" |
7 | 7 |
8 | 8 |
| 9 def CheckChangeHasTestField(input_api, output_api): |
| 10 """Requires that the changelist have a TEST= field.""" |
| 11 if input_api.change.Test: |
| 12 return [] |
| 13 else: |
| 14 return [output_api.PresubmitNotifyResult( |
| 15 "Changelist should have a TEST= field. TEST=none is allowed.")] |
| 16 |
| 17 |
| 18 def CheckChangeHasBugField(input_api, output_api): |
| 19 """Requires that the changelist have a BUG= field.""" |
| 20 if input_api.change.BugIDs: |
| 21 return [] |
| 22 else: |
| 23 return [output_api.PresubmitNotifyResult( |
| 24 "Changelist should have a BUG= field. BUG=none is allowed.")] |
| 25 |
| 26 |
9 def CheckChangeHasTestedField(input_api, output_api): | 27 def CheckChangeHasTestedField(input_api, output_api): |
10 """Requires that the changelist have a TESTED= field.""" | 28 """Requires that the changelist have a TESTED= field.""" |
11 if input_api.change.Tested: | 29 if input_api.change.Tested: |
12 return [] | 30 return [] |
13 else: | 31 else: |
14 return [output_api.PresubmitError("Changelist must have a TESTED= field.")] | 32 return [output_api.PresubmitError("Changelist must have a TESTED= field.")] |
15 | 33 |
16 | 34 |
17 def CheckChangeHasQaField(input_api, output_api): | 35 def CheckChangeHasQaField(input_api, output_api): |
18 """Requires that the changelist have a QA= field.""" | 36 """Requires that the changelist have a QA= field.""" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 connection = input_api.urllib2.urlopen(url) | 111 connection = input_api.urllib2.urlopen(url) |
94 status = connection.read() | 112 status = connection.read() |
95 connection.close() | 113 connection.close() |
96 if input_api.re.match(closed, status): | 114 if input_api.re.match(closed, status): |
97 long_text = status + '\n' + url | 115 long_text = status + '\n' + url |
98 return [output_api.PresubmitError("The tree is closed.", | 116 return [output_api.PresubmitError("The tree is closed.", |
99 long_text=long_text)] | 117 long_text=long_text)] |
100 except IOError: | 118 except IOError: |
101 pass | 119 pass |
102 return [] | 120 return [] |
OLD | NEW |