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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 206 |
207 class GIT(SCM): | 207 class GIT(SCM): |
208 """Gathers the options and diff for a git checkout.""" | 208 """Gathers the options and diff for a git checkout.""" |
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: |
| 217 self.diff_against = scm.GIT.GetUpstreamBranch(self.checkout_root) |
| 218 if not self.diff_against: |
| 219 print "Unable to determine default branch to diff against." |
| 220 print "Verify this branch is set up to track another" |
| 221 print "(via the --track argument to \"git checkout -b ...\"" |
216 logging.info("GIT(%s)" % self.checkout_root) | 222 logging.info("GIT(%s)" % self.checkout_root) |
217 | 223 |
218 def ReadRootFile(self, filename): | 224 def ReadRootFile(self, filename): |
219 try: | 225 try: |
220 # A git checkout is always a full checkout. | 226 # A git checkout is always a full checkout. |
221 data = gclient_utils.FileRead(os.path.join(self.checkout_root, filename)) | 227 data = gclient_utils.FileRead(os.path.join(self.checkout_root, filename)) |
222 logging.debug('%s:\n%s' % (filename, data)) | 228 logging.debug('%s:\n%s' % (filename, data)) |
223 return data | 229 return data |
224 except (IOError, OSError): | 230 except (IOError, OSError): |
225 logging.debug('%s:\nNone' % filename) | 231 logging.debug('%s:\nNone' % filename) |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 except (InvalidScript, NoTryServerAccess), e: | 702 except (InvalidScript, NoTryServerAccess), e: |
697 if swallow_exception: | 703 if swallow_exception: |
698 return 1 | 704 return 1 |
699 print e | 705 print e |
700 return 1 | 706 return 1 |
701 return 0 | 707 return 0 |
702 | 708 |
703 | 709 |
704 if __name__ == "__main__": | 710 if __name__ == "__main__": |
705 sys.exit(TryChange(None, [], False)) | 711 sys.exit(TryChange(None, [], False)) |
OLD | NEW |