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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 temp_file.flush() | 346 temp_file.flush() |
347 | 347 |
348 # Diff file | 348 # Diff file |
349 current_time = str(datetime.datetime.now()).replace(':', '.') | 349 current_time = str(datetime.datetime.now()).replace(':', '.') |
350 file_name = (EscapeDot(options.user) + '.' + EscapeDot(options.name) + | 350 file_name = (EscapeDot(options.user) + '.' + EscapeDot(options.name) + |
351 '.%s.diff' % current_time) | 351 '.%s.diff' % current_time) |
352 full_path = os.path.join(temp_dir, file_name) | 352 full_path = os.path.join(temp_dir, file_name) |
353 gclient_utils.FileWrite(full_path, options.diff, 'wb') | 353 gclient_utils.FileWrite(full_path, options.diff, 'wb') |
354 | 354 |
355 # Committing it will trigger a try job. | 355 # Committing it will trigger a try job. |
356 command = ['svn', 'import', '-q', temp_dir, options.svn_repo, '--file', | 356 if sys.platform == "cygwin": |
| 357 # Small chromium-specific issue here: |
| 358 # git-try uses /usr/bin/python on cygwin but svn.bat will be used |
| 359 # instead of /usr/bin/svn by default. That causes bad things(tm) since |
| 360 # Windows' svn.exe has no clue about cygwin paths. Hence force to use |
| 361 # the cygwin version in this particular context. |
| 362 exe = "/usr/bin/svn" |
| 363 else: |
| 364 exe = "svn" |
| 365 command = [exe, 'import', '-q', temp_dir, options.svn_repo, '--file', |
357 temp_file.name] | 366 temp_file.name] |
358 gclient_utils.CheckCall(command) | 367 gclient_utils.CheckCall(command) |
359 except gclient_utils.CheckCallError, e: | 368 except gclient_utils.CheckCallError, e: |
360 out = e.stdout | 369 out = e.stdout |
361 if e.stderr: | 370 if e.stderr: |
362 out += e.stderr | 371 out += e.stderr |
363 raise NoTryServerAccess(' '.join(e.command) + '\nOuput:\n' + out) | 372 raise NoTryServerAccess(' '.join(e.command) + '\nOuput:\n' + out) |
364 finally: | 373 finally: |
365 temp_file.close() | 374 temp_file.close() |
366 shutil.rmtree(temp_dir, True) | 375 shutil.rmtree(temp_dir, True) |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 except (InvalidScript, NoTryServerAccess), e: | 696 except (InvalidScript, NoTryServerAccess), e: |
688 if swallow_exception: | 697 if swallow_exception: |
689 return 1 | 698 return 1 |
690 print e | 699 print e |
691 return 1 | 700 return 1 |
692 return 0 | 701 return 0 |
693 | 702 |
694 | 703 |
695 if __name__ == "__main__": | 704 if __name__ == "__main__": |
696 sys.exit(TryChange(None, [], False)) | 705 sys.exit(TryChange(None, [], False)) |
OLD | NEW |