OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """Applies an issue from Rietveld. | 6 """Applies an issue from Rietveld. |
7 """ | 7 """ |
8 | 8 |
9 import getpass | 9 import getpass |
10 import json | 10 import json |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 num, options.server, issue_to_apply, patchset_to_apply) | 196 num, options.server, issue_to_apply, patchset_to_apply) |
197 num += 1 | 197 num += 1 |
198 print | 198 print |
199 | 199 |
200 for issue_to_apply, patchset_to_apply in issues_patchsets_to_apply: | 200 for issue_to_apply, patchset_to_apply in issues_patchsets_to_apply: |
201 issue_url = '%s/%d/#ps%d' % (options.server, issue_to_apply, | 201 issue_url = '%s/%d/#ps%d' % (options.server, issue_to_apply, |
202 patchset_to_apply) | 202 patchset_to_apply) |
203 print('Downloading patch from %s' % issue_url) | 203 print('Downloading patch from %s' % issue_url) |
204 try: | 204 try: |
205 patchset = obj.get_patch(issue_to_apply, patchset_to_apply) | 205 patchset = obj.get_patch(issue_to_apply, patchset_to_apply) |
206 except urllib2.URLError: | 206 except urllib2.HTTPError: |
207 logging.exception('failed to fetch the patch for issue %d, patchset %d.', | |
208 issue_to_apply, patchset_to_apply) | |
209 print( | 207 print( |
210 'Failed to fetch the patch for issue %d, patchset %d.\n' | 208 'Failed to fetch the patch for issue %d, patchset %d.\n' |
211 'Try visiting %s/%d') % ( | 209 'Try visiting %s/%d') % ( |
212 issue_to_apply, patchset_to_apply, | 210 issue_to_apply, patchset_to_apply, |
213 options.server, issue_to_apply) | 211 options.server, issue_to_apply) |
214 # Special code for bot_update to indicate that cause is network or | 212 # Special code for bot_update to indicate that cause is network or |
215 # Rietveld. Not 2, because 2 is returned on arg parsing failure. | 213 # Rietveld. Not 2, because 2 is returned on arg parsing failure. |
216 return 3 | 214 return 3 |
217 if options.whitelist: | 215 if options.whitelist: |
218 patchset.patches = [patch for patch in patchset.patches | 216 patchset.patches = [patch for patch in patchset.patches |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 annotated_gclient.emit_buildprops(revisions) | 278 annotated_gclient.emit_buildprops(revisions) |
281 | 279 |
282 return retcode | 280 return retcode |
283 return 0 | 281 return 0 |
284 | 282 |
285 | 283 |
286 if __name__ == "__main__": | 284 if __name__ == "__main__": |
287 fix_encoding.fix_encoding() | 285 fix_encoding.fix_encoding() |
288 try: | 286 try: |
289 sys.exit(main()) | 287 sys.exit(main()) |
| 288 except urllib2.URLError: |
| 289 # Weird flakiness of GAE, see http://crbug.com/537417 |
| 290 logging.exception('failed to fetch something from Rietveld') |
| 291 sys.exit(3) |
290 except KeyboardInterrupt: | 292 except KeyboardInterrupt: |
291 sys.stderr.write('interrupted\n') | 293 sys.stderr.write('interrupted\n') |
292 sys.exit(1) | 294 sys.exit(1) |
OLD | NEW |