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

Unified Diff: trychange.py

Issue 133933007: trychange.py: Use urllib2's urlopen() instead of urllib's. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Remove --proxy support Created 6 years, 11 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 | « tests/trychange_unittest.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trychange.py
diff --git a/trychange.py b/trychange.py
index be532d80cfa8f4dbaafd106757a4e7ec2272bedc..99070612648ad46b8d2197c0e0ea7499bc94f0b7 100755
--- a/trychange.py
+++ b/trychange.py
@@ -22,6 +22,7 @@ import shutil
import sys
import tempfile
import urllib
+import urllib2
import breakpad # pylint: disable=W0611
@@ -443,13 +444,6 @@ def _SendChangeHTTP(bot_spec, options):
values.append(('patch', options.diff))
url = 'http://%s:%s/send_try_patch' % (options.host, options.port)
- proxies = None
- if options.proxy:
- if options.proxy.lower() == 'none':
- # Effectively disable HTTP_PROXY or Internet settings proxy setup.
- proxies = {}
- else:
- proxies = {'http': options.proxy, 'https': options.proxy}
logging.info('Sending by HTTP')
logging.info(''.join("%s=%s\n" % (k, v) for k, v in values))
@@ -460,7 +454,7 @@ def _SendChangeHTTP(bot_spec, options):
try:
logging.info('Opening connection...')
- connection = urllib.urlopen(url, urllib.urlencode(values), proxies=proxies)
+ connection = urllib2.urlopen(url, urllib.urlencode(values))
logging.info('Done')
except IOError, e:
logging.info(str(e))
@@ -721,8 +715,6 @@ def gen_parser(prog):
help="Host address")
group.add_option("-P", "--port", type="int",
help="HTTP port")
- group.add_option("--proxy",
- help="HTTP proxy")
parser.add_option_group(group)
group = optparse.OptionGroup(parser, "Access the try server with SVN")
@@ -841,7 +833,7 @@ def TryChange(argv,
if options.url:
if options.files:
parser.error('You cannot specify files and --url at the same time.')
- options.diff = urllib.urlopen(options.url).read()
+ options.diff = urllib2.urlopen(options.url).read()
elif options.diff:
if options.files:
parser.error('You cannot specify files and --diff at the same time.')
@@ -851,11 +843,11 @@ def TryChange(argv,
# When patchset is specified, it's because it's done by gcl/git-try.
api_url = '%s/api/%d' % (options.rietveld_url, options.issue)
logging.debug(api_url)
- contents = json.loads(urllib.urlopen(api_url).read())
+ contents = json.loads(urllib2.urlopen(api_url).read())
options.patchset = contents['patchsets'][-1]
diff_url = ('%s/download/issue%d_%d.diff' %
(options.rietveld_url, options.issue, options.patchset))
- diff = GetMungedDiff('', urllib.urlopen(diff_url).readlines())
+ diff = GetMungedDiff('', urllib2.urlopen(diff_url).readlines())
options.diff = ''.join(diff[0])
changed_files = diff[1]
else:
« no previous file with comments | « tests/trychange_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698