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

Unified Diff: apply_issue.py

Issue 10913026: Handle when a patchset doesn't exist instead of printing a stack trace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apply_issue.py
diff --git a/apply_issue.py b/apply_issue.py
index 11ee9932e626219e357ebf0b7f8621f6955a7672..d79ee7b88ccc387cff4c0fcd5d0f7fcbbc879e1e 100755
--- a/apply_issue.py
+++ b/apply_issue.py
@@ -10,6 +10,7 @@ import logging
import optparse
import os
import sys
+import urllib2
import breakpad # pylint: disable=W0611
@@ -51,6 +52,9 @@ def main():
parser.error('Extra argument(s) "%s" not understood' % ' '.join(args))
if not options.issue:
parser.error('Require --issue')
+ options.server = options.server.rstrip('/')
+ if not options.server:
+ parser.error('Require a valid server')
# TODO(rogerta): Remove me, it's ugly.
if options.email == '=':
@@ -64,7 +68,15 @@ def main():
print('No patchset specified. Using patchset %d' % options.patchset)
print('Downloading the patch.')
- patchset = obj.get_patch(options.issue, options.patchset)
+ try:
+ patchset = obj.get_patch(options.issue, options.patchset)
+ except urllib2.HTTPError, e:
+ print >> sys.stderr, (
+ 'Failed to fetch the patch for issue %d, patchset %d.\n'
+ 'Try visiting %s/%d') % (
+ options.issue, options.patchset,
+ options.server, options.issue)
+ return 1
for patch in patchset.patches:
print(patch)
scm_type = scm.determine_scm(options.root_dir)
« 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