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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 def __init__(self, *args, **kwargs): | 209 def __init__(self, *args, **kwargs): |
210 SCM.__init__(self, *args, **kwargs) | 210 SCM.__init__(self, *args, **kwargs) |
211 self.checkout_root = scm.GIT.GetCheckoutRoot(self.checkout_root) | 211 self.checkout_root = scm.GIT.GetCheckoutRoot(self.checkout_root) |
212 if not self.options.name: | 212 if not self.options.name: |
213 self.options.name = scm.GIT.GetPatchName(self.checkout_root) | 213 self.options.name = scm.GIT.GetPatchName(self.checkout_root) |
214 if not self.options.email: | 214 if not self.options.email: |
215 self.options.email = scm.GIT.GetEmail(self.checkout_root) | 215 self.options.email = scm.GIT.GetEmail(self.checkout_root) |
216 if not self.diff_against: | 216 if not self.diff_against: |
217 self.diff_against = scm.GIT.GetUpstreamBranch(self.checkout_root) | 217 self.diff_against = scm.GIT.GetUpstreamBranch(self.checkout_root) |
218 if not self.diff_against: | 218 if not self.diff_against: |
219 print "Unable to determine default branch to diff against." | 219 raise NoTryServerAccess( |
220 print "Verify this branch is set up to track another" | 220 "Unable to determine default branch to diff against. " |
221 print "(via the --track argument to \"git checkout -b ...\"" | 221 "Verify this branch is set up to track another" |
| 222 "(via the --track argument to \"git checkout -b ...\"") |
222 logging.info("GIT(%s)" % self.checkout_root) | 223 logging.info("GIT(%s)" % self.checkout_root) |
223 | 224 |
224 def ReadRootFile(self, filename): | 225 def ReadRootFile(self, filename): |
225 try: | 226 try: |
226 # A git checkout is always a full checkout. | 227 # A git checkout is always a full checkout. |
227 data = gclient_utils.FileRead(os.path.join(self.checkout_root, filename)) | 228 data = gclient_utils.FileRead(os.path.join(self.checkout_root, filename)) |
228 logging.debug('%s:\n%s' % (filename, data)) | 229 logging.debug('%s:\n%s' % (filename, data)) |
229 return data | 230 return data |
230 except (IOError, OSError): | 231 except (IOError, OSError): |
231 logging.debug('%s:\nNone' % filename) | 232 logging.debug('%s:\nNone' % filename) |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 except (InvalidScript, NoTryServerAccess), e: | 703 except (InvalidScript, NoTryServerAccess), e: |
703 if swallow_exception: | 704 if swallow_exception: |
704 return 1 | 705 return 1 |
705 print e | 706 print e |
706 return 1 | 707 return 1 |
707 return 0 | 708 return 0 |
708 | 709 |
709 | 710 |
710 if __name__ == "__main__": | 711 if __name__ == "__main__": |
711 sys.exit(TryChange(None, [], False)) | 712 sys.exit(TryChange(None, [], False)) |
OLD | NEW |