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

Side by Side Diff: trychange.py

Issue 11574007: Move parsing of TRYSERVER_* so options.root is not overwritten (Closed) Base URL: http://src.chromium.org/svn/trunk/tools/depot_tools/
Patch Set: Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 """Client-side script to send a try job to the try server. It communicates to 6 """Client-side script to send a try job to the try server. It communicates to
7 the try server by either writting to a svn repository or by directly connecting 7 the try server by either writting to a svn repository or by directly connecting
8 to the server by HTTP. 8 to the server by HTTP.
9 """ 9 """
10 10
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 161 }
162 logging.info('\n'.join(['%s: %s' % (k, v) 162 logging.info('\n'.join(['%s: %s' % (k, v)
163 for (k, v) in settings.iteritems() if v])) 163 for (k, v) in settings.iteritems() if v]))
164 for (k, v) in settings.iteritems(): 164 for (k, v) in settings.iteritems():
165 if v and getattr(self.options, k) is None: 165 if v and getattr(self.options, k) is None:
166 setattr(self.options, k, v) 166 setattr(self.options, k, v)
167 167
168 def AutomagicalSettings(self): 168 def AutomagicalSettings(self):
169 """Determines settings based on supported code review and checkout tools. 169 """Determines settings based on supported code review and checkout tools.
170 """ 170 """
171 # Try to find gclient or repo root first. 171 self._GclStyleSettings()
M-A Ruel 2012/12/13 23:58:06 I'm pretty sure there was a reason for it to be do
kjellander_chromium 2012/12/18 08:52:15 I think it's pretty safe to move it. All the code
172 # Try to find gclient or repo root.
172 if not self.options.no_search: 173 if not self.options.no_search:
173 self.toplevel_root = gclient_utils.FindGclientRoot(self.checkout_root) 174 self.toplevel_root = gclient_utils.FindGclientRoot(self.checkout_root)
174 if self.toplevel_root: 175 if self.toplevel_root:
175 logging.info('Found .gclient at %s' % self.toplevel_root) 176 logging.info('Found .gclient at %s' % self.toplevel_root)
176 else: 177 else:
177 self.toplevel_root = gclient_utils.FindFileUpwards( 178 self.toplevel_root = gclient_utils.FindFileUpwards(
178 os.path.join('..', '.repo'), self.checkout_root) 179 os.path.join('..', '.repo'), self.checkout_root)
179 if self.toplevel_root: 180 if self.toplevel_root:
180 logging.info('Found .repo dir at %s' 181 logging.info('Found .repo dir at %s'
181 % os.path.dirname(self.toplevel_root)) 182 % os.path.dirname(self.toplevel_root))
182 183
183 if self.toplevel_root and not self.options.root: 184 if self.toplevel_root and not self.options.root:
184 assert os.path.abspath(self.toplevel_root) == self.toplevel_root 185 assert os.path.abspath(self.toplevel_root) == self.toplevel_root
185 self.options.root = gclient_utils.PathDifference(self.toplevel_root, 186 self.options.root = gclient_utils.PathDifference(self.toplevel_root,
186 self.checkout_root) 187 self.checkout_root)
187 188
188 self._GclStyleSettings()
189
190 def ReadRootFile(self, filename): 189 def ReadRootFile(self, filename):
191 cur = self.checkout_root 190 cur = self.checkout_root
192 root = self.toplevel_root or self.checkout_root 191 root = self.toplevel_root or self.checkout_root
193 192
194 assert cur.startswith(root), (root, cur) 193 assert cur.startswith(root), (root, cur)
195 while cur.startswith(root): 194 while cur.startswith(root):
196 filepath = os.path.join(cur, filename) 195 filepath = os.path.join(cur, filename)
197 if os.path.isfile(filepath): 196 if os.path.isfile(filepath):
198 logging.info('Found %s at %s' % (filename, cur)) 197 logging.info('Found %s at %s' % (filename, cur))
199 return gclient_utils.FileRead(filepath) 198 return gclient_utils.FileRead(filepath)
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 return 1 873 return 1
875 except (gclient_utils.Error, subprocess2.CalledProcessError), e: 874 except (gclient_utils.Error, subprocess2.CalledProcessError), e:
876 print >> sys.stderr, e 875 print >> sys.stderr, e
877 return 1 876 return 1
878 return 0 877 return 0
879 878
880 879
881 if __name__ == "__main__": 880 if __name__ == "__main__":
882 fix_encoding.fix_encoding() 881 fix_encoding.fix_encoding()
883 sys.exit(TryChange(None, None, False)) 882 sys.exit(TryChange(None, None, False))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698