OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 if os.path.isdir(os.path.join(real_path, '.svn')): | 452 if os.path.isdir(os.path.join(real_path, '.svn')): |
453 return SVN(options, path, file_list) | 453 return SVN(options, path, file_list) |
454 | 454 |
455 # Git has a command to test if you're in a git tree. | 455 # Git has a command to test if you're in a git tree. |
456 # Try running it, but don't die if we don't have git installed. | 456 # Try running it, but don't die if we don't have git installed. |
457 try: | 457 try: |
458 subprocess2.check_output( | 458 subprocess2.check_output( |
459 ['git', 'rev-parse', '--is-inside-work-tree'], cwd=real_path, | 459 ['git', 'rev-parse', '--is-inside-work-tree'], cwd=real_path, |
460 stderr=subprocess2.VOID) | 460 stderr=subprocess2.VOID) |
461 return GIT(options, path, file_list) | 461 return GIT(options, path, file_list) |
| 462 except OSError, e: |
| 463 if e.errno != errno.ENOENT: |
| 464 raise |
462 except subprocess2.CalledProcessError, e: | 465 except subprocess2.CalledProcessError, e: |
463 if e.returncode != errno.ENOENT and e.returncode != 128: | 466 if e.returncode != errno.ENOENT and e.returncode != 128: |
464 # ENOENT == 2 = they don't have git installed. | 467 # ENOENT == 2 = they don't have git installed. |
465 # 128 = git error code when not in a repo. | 468 # 128 = git error code when not in a repo. |
466 logging.warning('Unexpected error code: %s' % e.returncode) | 469 logging.warning('Unexpected error code: %s' % e.returncode) |
467 raise | 470 raise |
468 raise NoTryServerAccess("Could not guess version control system. " | 471 raise NoTryServerAccess("Could not guess version control system. " |
469 "Are you in a working copy directory?") | 472 "Are you in a working copy directory?") |
470 | 473 |
471 | 474 |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 return 1 | 814 return 1 |
812 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 815 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
813 print >> sys.stderr, e | 816 print >> sys.stderr, e |
814 return 1 | 817 return 1 |
815 return 0 | 818 return 0 |
816 | 819 |
817 | 820 |
818 if __name__ == "__main__": | 821 if __name__ == "__main__": |
819 fix_encoding.fix_encoding() | 822 fix_encoding.fix_encoding() |
820 sys.exit(TryChange(None, None, False)) | 823 sys.exit(TryChange(None, None, False)) |
OLD | NEW |