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

Unified Diff: trychange.py

Issue 3390013: Reuse gcl.py's code review settings when running [gcl try], as gcl is ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/tools/depot_tools/
Patch Set: '' Created 10 years, 2 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 | « tests/trychange_unittest.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trychange.py
===================================================================
--- trychange.py (revision 61647)
+++ trychange.py (working copy)
@@ -33,6 +33,14 @@
except ImportError:
pass
+# We try to use gcl.py's GetCodeReviewSettings function if available.
+GclGetCodeReviewSetting = None
M-A Ruel 2010/10/06 23:43:18 I'd prefer gcl = None and use if gcl: return gcl.G
Jói 2010/10/06 23:54:03 Done.
+try:
+ import gcl
+ GclGetCodeReviewSetting = gcl.GetCodeReviewSetting
+except:
M-A Ruel 2010/10/06 23:43:18 except ImportError:
Jói 2010/10/06 23:54:03 Done.
+ pass
+
import gclient_utils
import scm
@@ -106,17 +114,21 @@
def GetCodeReviewSetting(self, key):
"""Returns a value for the given key for this repository.
- Uses gcl-style settings from the repository."""
- if self.codereview_settings is None:
- self.codereview_settings = {}
- settings_file = self.ReadRootFile(self.codereview_settings_file)
- if settings_file:
- for line in settings_file.splitlines():
- if not line or line.lstrip().startswith('#'):
- continue
- k, v = line.split(":", 1)
- self.codereview_settings[k.strip()] = v.strip()
- return self.codereview_settings.get(key, '')
+ Uses gcl-style settings from the repository.
+ """
+ if GclGetCodeReviewSetting:
+ return GclGetCodeReviewSetting(key)
+ else:
+ if self.codereview_settings is None:
+ self.codereview_settings = {}
+ settings_file = self.ReadRootFile(self.codereview_settings_file)
+ if settings_file:
+ for line in settings_file.splitlines():
+ if not line or line.lstrip().startswith('#'):
+ continue
+ k, v = line.split(":", 1)
+ self.codereview_settings[k.strip()] = v.strip()
+ return self.codereview_settings.get(key, '')
def _GclStyleSettings(self):
"""Set default settings based on the gcl-style settings from the
« no previous file with comments | « tests/trychange_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698