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

Unified Diff: gclient_utils.py

Issue 9214002: Dedupe codereview.settings parsing code. Add more testing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 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 | « gcl.py ('k') | git_cl.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_utils.py
diff --git a/gclient_utils.py b/gclient_utils.py
index bad86915b332a02ce1c8cb826cdd1bbfe639c96e..1edce769a71e8dc3ad88384ee7a2c4fc22a230f8 100644
--- a/gclient_utils.py
+++ b/gclient_utils.py
@@ -732,3 +732,15 @@ def RunEditor(content, git):
return FileRead(filename)
finally:
os.remove(filename)
+
+
+def ParseCodereviewSettingsContent(content):
+ """Process a codereview.settings file properly."""
+ lines = (l for l in content.splitlines() if not l.strip().startswith("#"))
+ try:
+ keyvals = dict([x.strip() for x in l.split(':', 1)] for l in lines if l)
+ except ValueError:
+ raise Error(
+ 'Failed to process settings, please fix. Content:\n\n%s' % content)
+ # TODO(maruel): Post-process
+ return keyvals
« no previous file with comments | « gcl.py ('k') | git_cl.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698