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

Side by Side Diff: gclient_utils.py

Issue 10910225: Switch gcl/git upload to use https://codereview.chromium.org instead of https://chromiumcodereview.… (Closed) Base URL: http://src.chromium.org/svn/trunk/tools/depot_tools/
Patch Set: Created 8 years, 3 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 | tests/gclient_utils_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Generic utils.""" 5 """Generic utils."""
6 6
7 import codecs 7 import codecs
8 import errno 8 import errno
9 import logging 9 import logging
10 import os 10 import os
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 return url 745 return url
746 if not re.match(r'[a-z\-]+\://.*', url): 746 if not re.match(r'[a-z\-]+\://.*', url):
747 # Make sure it is a valid uri. Otherwise, urlparse() will consider it a 747 # Make sure it is a valid uri. Otherwise, urlparse() will consider it a
748 # relative url and will use http:///foo. Note that it defaults to http:// 748 # relative url and will use http:///foo. Note that it defaults to http://
749 # for compatibility with naked url like "localhost:8080". 749 # for compatibility with naked url like "localhost:8080".
750 url = 'http://%s' % url 750 url = 'http://%s' % url
751 parsed = list(urlparse.urlparse(url)) 751 parsed = list(urlparse.urlparse(url))
752 # Do not automatically upgrade http to https if a port number is provided. 752 # Do not automatically upgrade http to https if a port number is provided.
753 if parsed[0] == 'http' and not re.match(r'^.+?\:\d+$', parsed[1]): 753 if parsed[0] == 'http' and not re.match(r'^.+?\:\d+$', parsed[1]):
754 parsed[0] = 'https' 754 parsed[0] = 'https'
755 # Until GAE supports SNI, manually convert the url.
756 if parsed[1] == 'codereview.chromium.org':
757 parsed[1] = 'chromiumcodereview.appspot.com'
758 return urlparse.urlunparse(parsed) 755 return urlparse.urlunparse(parsed)
759 756
760 757
761 def ParseCodereviewSettingsContent(content): 758 def ParseCodereviewSettingsContent(content):
762 """Process a codereview.settings file properly.""" 759 """Process a codereview.settings file properly."""
763 lines = (l for l in content.splitlines() if not l.strip().startswith("#")) 760 lines = (l for l in content.splitlines() if not l.strip().startswith("#"))
764 try: 761 try:
765 keyvals = dict([x.strip() for x in l.split(':', 1)] for l in lines if l) 762 keyvals = dict([x.strip() for x in l.split(':', 1)] for l in lines if l)
766 except ValueError: 763 except ValueError:
767 raise Error( 764 raise Error(
768 'Failed to process settings, please fix. Content:\n\n%s' % content) 765 'Failed to process settings, please fix. Content:\n\n%s' % content)
769 def fix_url(key): 766 def fix_url(key):
770 if keyvals.get(key): 767 if keyvals.get(key):
771 keyvals[key] = UpgradeToHttps(keyvals[key]) 768 keyvals[key] = UpgradeToHttps(keyvals[key])
772 fix_url('CODE_REVIEW_SERVER') 769 fix_url('CODE_REVIEW_SERVER')
773 fix_url('VIEW_VC') 770 fix_url('VIEW_VC')
774 return keyvals 771 return keyvals
OLDNEW
« no previous file with comments | « no previous file | tests/gclient_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698