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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_utils.FileRead(filepath) | 159 return gclient_utils.FileRead(filepath) |
160 return None | 160 return None |
161 cur = os.path.abspath(self.checkout_root) | 161 cur = os.path.abspath(self.checkout_root) |
162 if self.gclient_root: | 162 if self.gclient_root: |
163 root = os.path.abspath(self.gclient_root) | 163 root = os.path.abspath(self.gclient_root) |
164 else: | 164 else: |
165 root = gclient_utils.FindGclientRoot(cur) | 165 root = gclient_utils.FindGclientRoot(cur) |
| 166 if not root: |
| 167 root = cur |
166 assert cur.startswith(root), (root, cur) | 168 assert cur.startswith(root), (root, cur) |
167 while cur.startswith(root): | 169 while cur.startswith(root): |
168 filepath = os.path.join(cur, filename) | 170 filepath = os.path.join(cur, filename) |
169 if os.path.isfile(filepath): | 171 if os.path.isfile(filepath): |
170 logging.info('Found %s at %s' % (filename, cur)) | 172 logging.info('Found %s at %s' % (filename, cur)) |
171 return gclient_utils.FileRead(filepath) | 173 return gclient_utils.FileRead(filepath) |
172 cur = os.path.dirname(cur) | 174 cur = os.path.dirname(cur) |
173 logging.warning('Didn\'t find %s' % filename) | 175 logging.warning('Didn\'t find %s' % filename) |
174 return None | 176 return None |
175 | 177 |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 except (InvalidScript, NoTryServerAccess), e: | 735 except (InvalidScript, NoTryServerAccess), e: |
734 if swallow_exception: | 736 if swallow_exception: |
735 return 1 | 737 return 1 |
736 print e | 738 print e |
737 return 1 | 739 return 1 |
738 return 0 | 740 return 0 |
739 | 741 |
740 | 742 |
741 if __name__ == "__main__": | 743 if __name__ == "__main__": |
742 sys.exit(TryChange(None, [], False)) | 744 sys.exit(TryChange(None, [], False)) |
OLD | NEW |