Index: gclient_utils.py |
diff --git a/gclient_utils.py b/gclient_utils.py |
index 1edce769a71e8dc3ad88384ee7a2c4fc22a230f8..a3782c74d7a822cd112665c9aee0aa443be82625 100644 |
--- a/gclient_utils.py |
+++ b/gclient_utils.py |
@@ -734,6 +734,25 @@ def RunEditor(content, git): |
os.remove(filename) |
+def UpgradeToHttps(url): |
+ """Upgrades random urls to https://. |
+ |
+ Do not touch unknown urls like ssh:// or git://. |
+ Fixes invalid GAE url. |
+ """ |
+ if not url: |
+ return url |
+ if not re.match(r'[a-z\-]+\://.*', url): |
+ # Make sure it is a valid uri. |
+ url = 'https://%s' % url |
+ url = re.sub(r'^http\:', r'https:', url) |
+ url = re.sub( |
+ '^https\:\/\/codereview.chromium.org', |
+ 'https://chromiumcodereview.appspot.com', |
+ url) |
+ return url |
+ |
+ |
def ParseCodereviewSettingsContent(content): |
"""Process a codereview.settings file properly.""" |
lines = (l for l in content.splitlines() if not l.strip().startswith("#")) |
@@ -742,5 +761,9 @@ def ParseCodereviewSettingsContent(content): |
except ValueError: |
raise Error( |
'Failed to process settings, please fix. Content:\n\n%s' % content) |
- # TODO(maruel): Post-process |
+ def fix_url(key): |
+ if keyvals.get(key): |
+ keyvals[key] = UpgradeToHttps(keyvals[key]) |
+ fix_url('CODE_REVIEW_SERVER') |
+ fix_url('VIEW_VC') |
return keyvals |