OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 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 """Client-side script to send a try job to the try server. It communicates to | 5 """Client-side script to send a try job to the try server. It communicates to |
6 the try server by either writting to a svn repository or by directly connecting | 6 the try server by either writting to a svn repository or by directly connecting |
7 to the server by HTTP. | 7 to the server by HTTP. |
8 """ | 8 """ |
9 | 9 |
10 import datetime | 10 import datetime |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
151 self._GclientStyleSettings() | 151 self._GclientStyleSettings() |
152 self._GclStyleSettings() | 152 self._GclStyleSettings() |
153 | 153 |
154 def ReadRootFile(self, filename): | 154 def ReadRootFile(self, filename): |
155 if not self.options.root: | 155 if not self.options.root: |
156 filepath = os.path.join(self.checkout_root, filename) | 156 filepath = os.path.join(self.checkout_root, filename) |
157 if os.path.isfile(filepath): | 157 if os.path.isfile(filepath): |
158 logging.info('Found %s at %s' % (filename, self.checkout_root)) | 158 logging.info('Found %s at %s' % (filename, self.checkout_root)) |
159 return gclient_util.FileRead(filepath) | 159 return gclient_util.FileRead(filepath) |
160 return None | 160 return None |
161 root = os.path.abspath(self.gclient_root) | |
162 cur = os.path.abspath(self.checkout_root) | 161 cur = os.path.abspath(self.checkout_root) |
162 if self.gclient_root: | |
163 root = os.path.abspath(self.gclient_root) | |
164 else: | |
165 root = gclient_utils.FindGclientRoot(cur) | |
M-A Ruel
2010/05/15 00:53:14
As I wrote earlier, I still prefer to use root = c
| |
163 assert cur.startswith(root), (root, cur) | 166 assert cur.startswith(root), (root, cur) |
164 while cur.startswith(root): | 167 while cur.startswith(root): |
165 filepath = os.path.join(cur, filename) | 168 filepath = os.path.join(cur, filename) |
166 if os.path.isfile(filepath): | 169 if os.path.isfile(filepath): |
167 logging.info('Found %s at %s' % (filename, cur)) | 170 logging.info('Found %s at %s' % (filename, cur)) |
168 return gclient_utils.FileRead(filepath) | 171 return gclient_utils.FileRead(filepath) |
169 cur = os.path.dirname(cur) | 172 cur = os.path.dirname(cur) |
170 logging.warning('Didn\'t find %s' % filename) | 173 logging.warning('Didn\'t find %s' % filename) |
171 return None | 174 return None |
172 | 175 |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
718 except (InvalidScript, NoTryServerAccess), e: | 721 except (InvalidScript, NoTryServerAccess), e: |
719 if swallow_exception: | 722 if swallow_exception: |
720 return 1 | 723 return 1 |
721 print e | 724 print e |
722 return 1 | 725 return 1 |
723 return 0 | 726 return 0 |
724 | 727 |
725 | 728 |
726 if __name__ == "__main__": | 729 if __name__ == "__main__": |
727 sys.exit(TryChange(None, [], False)) | 730 sys.exit(TryChange(None, [], False)) |
OLD | NEW |