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

Side by Side Diff: PRESUBMIT.py

Issue 207030: Fix try job status PRESUBMIT check when an issue is private.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 3 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 | Annotate | Revision Log
« 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 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 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 """Top-level presubmit script for Chromium. 6 """Top-level presubmit script for Chromium.
7 7
8 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts 8 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
9 for details on the presubmit API built into gcl. 9 for details on the presubmit API built into gcl.
10 """ 10 """
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 if not input_api.change.issue or not input_api.change.patchset: 79 if not input_api.change.issue or not input_api.change.patchset:
80 return outputs 80 return outputs
81 url = "http://codereview.chromium.org/%d/get_build_results/%d" % ( 81 url = "http://codereview.chromium.org/%d/get_build_results/%d" % (
82 input_api.change.issue, input_api.change.patchset) 82 input_api.change.issue, input_api.change.patchset)
83 PLATFORMS = ('win', 'linux', 'mac') 83 PLATFORMS = ('win', 'linux', 'mac')
84 try: 84 try:
85 connection = input_api.urllib2.urlopen(url) 85 connection = input_api.urllib2.urlopen(url)
86 # platform|status|url 86 # platform|status|url
87 values = [item.split('|', 2) for item in connection.read().splitlines()] 87 values = [item.split('|', 2) for item in connection.read().splitlines()]
88 connection.close() 88 connection.close()
89 if not values:
90 # It returned an empty list. Probably a private review.
91 return outputs
89 # Reformat as an dict of platform: [status, url] 92 # Reformat as an dict of platform: [status, url]
90 values = dict([[v[0], [v[1], v[2]]] for v in values]) 93 values = dict([[v[0], [v[1], v[2]]] for v in values])
91 for platform in PLATFORMS: 94 for platform in PLATFORMS:
92 values.setdefault(platform, ['not started', '']) 95 values.setdefault(platform, ['not started', ''])
93 message = None 96 message = None
94 non_success = [k.upper() for k,v in values.iteritems() if v[0] != 'success'] 97 non_success = [k.upper() for k,v in values.iteritems() if v[0] != 'success']
95 if 'failure' in [v[0] for v in values.itervalues()]: 98 if 'failure' in [v[0] for v in values.itervalues()]:
96 message = 'Try job failures on %s!\n' % ', '.join(non_success) 99 message = 'Try job failures on %s!\n' % ', '.join(non_success)
97 elif non_success: 100 elif non_success:
98 message = ('Unfinished (or not even started) try jobs on ' 101 message = ('Unfinished (or not even started) try jobs on '
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 connection = input_api.urllib2.urlopen(url_text) 136 connection = input_api.urllib2.urlopen(url_text)
134 long_text = connection.read().strip() 137 long_text = connection.read().strip()
135 connection.close() 138 connection.close()
136 except IOError: 139 except IOError:
137 pass 140 pass
138 return [output_api.PresubmitError("The tree is closed.", 141 return [output_api.PresubmitError("The tree is closed.",
139 long_text=long_text)] 142 long_text=long_text)]
140 except IOError: 143 except IOError:
141 pass 144 pass
142 return [] 145 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