Chromium Code Reviews| Index: trychange.py |
| diff --git a/trychange.py b/trychange.py |
| index 7d2ccda0b3fd10b0f55805d546bacfa4e6662662..0814306a3b886446b90acb1f7c90c5a85ab5f35c 100755 |
| --- a/trychange.py |
| +++ b/trychange.py |
| @@ -149,8 +149,10 @@ class SCM(object): |
| return self.codereview_settings.get(key, '') |
| def _GclStyleSettings(self): |
| - """Set default settings based on the gcl-style settings from the |
| - repository.""" |
| + """Set default settings based on the gcl-style settings from the repository. |
| + |
| + This method needs to be called after self.top_level_root has been set. |
|
M-A Ruel
2012/12/19 13:46:12
Add an assert instead?
kjellander_chromium
2012/12/19 16:16:15
Actually I think it's a bit confusing to say it ha
|
| + """ |
| settings = { |
| 'port': self.GetCodeReviewSetting('TRYSERVER_HTTP_PORT'), |
| 'host': self.GetCodeReviewSetting('TRYSERVER_HTTP_HOST'), |
| @@ -162,14 +164,14 @@ class SCM(object): |
| logging.info('\n'.join(['%s: %s' % (k, v) |
| for (k, v) in settings.iteritems() if v])) |
| for (k, v) in settings.iteritems(): |
| + # Do not overwrite options already set using command line flags. |
| if v and getattr(self.options, k) is None: |
| setattr(self.options, k, v) |
| def AutomagicalSettings(self): |
| """Determines settings based on supported code review and checkout tools. |
| """ |
| - self._GclStyleSettings() |
| - # Try to find gclient or repo root. |
| + # Try to find gclient or repo root first. |
| if not self.options.no_search: |
| self.toplevel_root = gclient_utils.FindGclientRoot(self.checkout_root) |
| if self.toplevel_root: |
| @@ -181,10 +183,17 @@ class SCM(object): |
| logging.info('Found .repo dir at %s' |
| % os.path.dirname(self.toplevel_root)) |
| + # Parse TRYSERVER_* settings from codereview.settings before falling back |
| + # on setting self.options.root manually further down. Otherwise |
| + # TRYSERVER_ROOT would never be used in codereview.settings. |
| + self._GclStyleSettings() |
| + |
| if self.toplevel_root and not self.options.root: |
| assert os.path.abspath(self.toplevel_root) == self.toplevel_root |
| self.options.root = gclient_utils.PathDifference(self.toplevel_root, |
| self.checkout_root) |
| + else: |
| + self._GclStyleSettings() |
| def ReadRootFile(self, filename): |
| cur = self.checkout_root |