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

Side by Side Diff: apply_issue.py

Issue 1385653002: apply_issue: actually catch exception during patch download. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 5 years, 2 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/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
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.HTTPError as e: 206 except urllib2.URLError:
207 logging.exception('failed to fetch the patch for issue %d, patchset %d.',
208 issue_to_apply, patchset_to_apply)
207 print( 209 print(
208 'Failed to fetch the patch for issue %d, patchset %d.\n' 210 'Failed to fetch the patch for issue %d, patchset %d.\n'
209 'Try visiting %s/%d') % ( 211 'Try visiting %s/%d') % (
210 issue_to_apply, patchset_to_apply, 212 issue_to_apply, patchset_to_apply,
211 options.server, issue_to_apply) 213 options.server, issue_to_apply)
212 # Special code for bot_update to indicate that cause is network or 214 # Special code for bot_update to indicate that cause is network or
213 # Rietveld. Not 2, because 2 is returned on arg parsing failure. 215 # Rietveld. Not 2, because 2 is returned on arg parsing failure.
214 return 3 216 return 3
215 if options.whitelist: 217 if options.whitelist:
216 patchset.patches = [patch for patch in patchset.patches 218 patchset.patches = [patch for patch in patchset.patches
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 return 0 283 return 0
282 284
283 285
284 if __name__ == "__main__": 286 if __name__ == "__main__":
285 fix_encoding.fix_encoding() 287 fix_encoding.fix_encoding()
286 try: 288 try:
287 sys.exit(main()) 289 sys.exit(main())
288 except KeyboardInterrupt: 290 except KeyboardInterrupt:
289 sys.stderr.write('interrupted\n') 291 sys.stderr.write('interrupted\n')
290 sys.exit(1) 292 sys.exit(1)
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