Commit 9dbbe54f authored by maruel@chromium.org's avatar maruel@chromium.org

Handle when a patchset doesn't exist instead of printing a stack trace.

Print a meaningful error message so the user can try diagnosing himself.

R=rogerta@chromium.org
BUG=


Review URL: https://chromiumcodereview.appspot.com/10913026

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@154436 0039d316-1c4b-4281-b951-d872f2087c98
parent 4c422e9b
...@@ -10,6 +10,7 @@ import logging ...@@ -10,6 +10,7 @@ import logging
import optparse import optparse
import os import os
import sys import sys
import urllib2
import breakpad # pylint: disable=W0611 import breakpad # pylint: disable=W0611
...@@ -51,6 +52,9 @@ def main(): ...@@ -51,6 +52,9 @@ def main():
parser.error('Extra argument(s) "%s" not understood' % ' '.join(args)) parser.error('Extra argument(s) "%s" not understood' % ' '.join(args))
if not options.issue: if not options.issue:
parser.error('Require --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. # TODO(rogerta): Remove me, it's ugly.
if options.email == '=': if options.email == '=':
...@@ -64,7 +68,15 @@ def main(): ...@@ -64,7 +68,15 @@ def main():
print('No patchset specified. Using patchset %d' % options.patchset) print('No patchset specified. Using patchset %d' % options.patchset)
print('Downloading the patch.') print('Downloading the patch.')
try:
patchset = obj.get_patch(options.issue, options.patchset) 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: for patch in patchset.patches:
print(patch) print(patch)
scm_type = scm.determine_scm(options.root_dir) scm_type = scm.determine_scm(options.root_dir)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment