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

Side by Side Diff: gcl.py

Issue 3140023: Make codereview.setting syntax more liberal and add more unit tests. (Closed)
Patch Set: Created 10 years, 4 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
« no previous file with comments | « no previous file | tests/gcl_unittest.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 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2006-2009 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 if '__just_initialized' not in CODEREVIEW_SETTINGS: 184 if '__just_initialized' not in CODEREVIEW_SETTINGS:
185 settings_file = GetCachedFile(CODEREVIEW_SETTINGS_FILE) 185 settings_file = GetCachedFile(CODEREVIEW_SETTINGS_FILE)
186 if settings_file: 186 if settings_file:
187 for line in settings_file.splitlines(): 187 for line in settings_file.splitlines():
188 if not line or line.startswith('#'): 188 if not line or line.startswith('#'):
189 continue 189 continue
190 if not ':' in line: 190 if not ':' in line:
191 raise gclient_utils.Error( 191 raise gclient_utils.Error(
192 '%s is invalid, please fix. It\'s content:\n\n%s' % 192 '%s is invalid, please fix. It\'s content:\n\n%s' %
193 (CODEREVIEW_SETTINGS_FILE, settings_file)) 193 (CODEREVIEW_SETTINGS_FILE, settings_file))
194 k, v = line.split(': ', 1) 194 k, v = line.split(':', 1)
195 CODEREVIEW_SETTINGS[k] = v 195 CODEREVIEW_SETTINGS[k.strip()] = v.strip()
196 CODEREVIEW_SETTINGS.setdefault('__just_initialized', None) 196 CODEREVIEW_SETTINGS.setdefault('__just_initialized', None)
197 return CODEREVIEW_SETTINGS.get(key, "") 197 return CODEREVIEW_SETTINGS.get(key, "")
198 198
199 199
200 def Warn(msg): 200 def Warn(msg):
201 print >> sys.stderr, msg 201 print >> sys.stderr, msg
202 202
203 203
204 def ErrorExit(msg): 204 def ErrorExit(msg):
205 print >> sys.stderr, msg 205 print >> sys.stderr, msg
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 if command: 1320 if command:
1321 return command(argv[1:]) 1321 return command(argv[1:])
1322 # Unknown command, try to pass that to svn 1322 # Unknown command, try to pass that to svn
1323 return CMDpassthru(argv) 1323 return CMDpassthru(argv)
1324 except gclient_utils.Error, e: 1324 except gclient_utils.Error, e:
1325 print('Got an exception') 1325 print('Got an exception')
1326 print(str(e)) 1326 print(str(e))
1327 1327
1328 if __name__ == "__main__": 1328 if __name__ == "__main__":
1329 sys.exit(main(sys.argv[1:])) 1329 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | tests/gcl_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698