OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """\ | 6 """\ |
7 Wrapper script around Rietveld's upload.py that simplifies working with groups | 7 Wrapper script around Rietveld's upload.py that simplifies working with groups |
8 of files. | 8 of files. |
9 """ | 9 """ |
10 | 10 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 return FILES_CACHE[filename] | 201 return FILES_CACHE[filename] |
202 | 202 |
203 | 203 |
204 def GetCodeReviewSetting(key): | 204 def GetCodeReviewSetting(key): |
205 """Returns a value for the given key for this repository.""" | 205 """Returns a value for the given key for this repository.""" |
206 # Use '__just_initialized' as a flag to determine if the settings were | 206 # Use '__just_initialized' as a flag to determine if the settings were |
207 # already initialized. | 207 # already initialized. |
208 if '__just_initialized' not in CODEREVIEW_SETTINGS: | 208 if '__just_initialized' not in CODEREVIEW_SETTINGS: |
209 settings_file = GetCachedFile(CODEREVIEW_SETTINGS_FILE) | 209 settings_file = GetCachedFile(CODEREVIEW_SETTINGS_FILE) |
210 if settings_file: | 210 if settings_file: |
211 for line in settings_file.splitlines(): | 211 CODEREVIEW_SETTINGS.update( |
212 if not line or line.startswith('#'): | 212 gclient_utils.ParseCodereviewSettingsContent(settings_file)) |
213 continue | |
214 if not ':' in line: | |
215 raise gclient_utils.Error( | |
216 '%s is invalid, please fix. It\'s content:\n\n%s' % | |
217 (CODEREVIEW_SETTINGS_FILE, settings_file)) | |
218 k, v = line.split(':', 1) | |
219 CODEREVIEW_SETTINGS[k.strip()] = v.strip() | |
220 CODEREVIEW_SETTINGS.setdefault('__just_initialized', None) | 213 CODEREVIEW_SETTINGS.setdefault('__just_initialized', None) |
221 return CODEREVIEW_SETTINGS.get(key, "") | 214 return CODEREVIEW_SETTINGS.get(key, "") |
222 | 215 |
223 | 216 |
224 def Warn(msg): | 217 def Warn(msg): |
225 print >> sys.stderr, msg | 218 print >> sys.stderr, msg |
226 | 219 |
227 | 220 |
228 def ErrorExit(msg): | 221 def ErrorExit(msg): |
229 print >> sys.stderr, msg | 222 print >> sys.stderr, msg |
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1464 raise | 1457 raise |
1465 print >> sys.stderr, ( | 1458 print >> sys.stderr, ( |
1466 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 1459 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
1467 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) | 1460 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) |
1468 return 1 | 1461 return 1 |
1469 | 1462 |
1470 | 1463 |
1471 if __name__ == "__main__": | 1464 if __name__ == "__main__": |
1472 fix_encoding.fix_encoding() | 1465 fix_encoding.fix_encoding() |
1473 sys.exit(main(sys.argv[1:])) | 1466 sys.exit(main(sys.argv[1:])) |
OLD | NEW |