OLD | NEW |
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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 try: | 392 try: |
393 # Description | 393 # Description |
394 temp_file.write(description) | 394 temp_file.write(description) |
395 temp_file.flush() | 395 temp_file.flush() |
396 | 396 |
397 # Diff file | 397 # Diff file |
398 current_time = str(datetime.datetime.now()).replace(':', '.') | 398 current_time = str(datetime.datetime.now()).replace(':', '.') |
399 file_name = (Escape(options.user) + '.' + Escape(options.name) + | 399 file_name = (Escape(options.user) + '.' + Escape(options.name) + |
400 '.%s.diff' % current_time) | 400 '.%s.diff' % current_time) |
401 full_path = os.path.join(temp_dir, file_name) | 401 full_path = os.path.join(temp_dir, file_name) |
402 gclient_utils.FileWrite(full_path, options.diff, 'wb') | 402 with open(full_path, 'wb') as f: |
| 403 f.write(options.diff) |
403 | 404 |
404 # Committing it will trigger a try job. | 405 # Committing it will trigger a try job. |
405 if sys.platform == "cygwin": | 406 if sys.platform == "cygwin": |
406 # Small chromium-specific issue here: | 407 # Small chromium-specific issue here: |
407 # git-try uses /usr/bin/python on cygwin but svn.bat will be used | 408 # git-try uses /usr/bin/python on cygwin but svn.bat will be used |
408 # instead of /usr/bin/svn by default. That causes bad things(tm) since | 409 # instead of /usr/bin/svn by default. That causes bad things(tm) since |
409 # Windows' svn.exe has no clue about cygwin paths. Hence force to use | 410 # Windows' svn.exe has no clue about cygwin paths. Hence force to use |
410 # the cygwin version in this particular context. | 411 # the cygwin version in this particular context. |
411 exe = "/usr/bin/svn" | 412 exe = "/usr/bin/svn" |
412 else: | 413 else: |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 return 1 | 838 return 1 |
838 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 839 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
839 print >> sys.stderr, e | 840 print >> sys.stderr, e |
840 return 1 | 841 return 1 |
841 return 0 | 842 return 0 |
842 | 843 |
843 | 844 |
844 if __name__ == "__main__": | 845 if __name__ == "__main__": |
845 fix_encoding.fix_encoding() | 846 fix_encoding.fix_encoding() |
846 sys.exit(TryChange(None, None, False)) | 847 sys.exit(TryChange(None, None, False)) |
OLD | NEW |