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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 __pychecker__ = 'no-returnvalues' | 429 __pychecker__ = 'no-returnvalues' |
430 real_path = path.split('@')[0] | 430 real_path = path.split('@')[0] |
431 logging.info("GuessVCS(%s)" % path) | 431 logging.info("GuessVCS(%s)" % path) |
432 # Subversion has a .svn in all working directories. | 432 # Subversion has a .svn in all working directories. |
433 if os.path.isdir(os.path.join(real_path, '.svn')): | 433 if os.path.isdir(os.path.join(real_path, '.svn')): |
434 return SVN(options, path) | 434 return SVN(options, path) |
435 | 435 |
436 # Git has a command to test if you're in a git tree. | 436 # Git has a command to test if you're in a git tree. |
437 # Try running it, but don't die if we don't have git installed. | 437 # Try running it, but don't die if we don't have git installed. |
438 try: | 438 try: |
439 gclient_utils.CheckCall(["git", "rev-parse", "--is-inside-work-tree"], | 439 gclient_utils.CheckCall(['git', 'rev-parse', '--is-inside-work-tree'], |
440 real_path) | 440 cwd=real_path) |
441 return GIT(options, path) | 441 return GIT(options, path) |
442 except gclient_utils.CheckCallError, e: | 442 except gclient_utils.CheckCallError, e: |
443 if e.returncode != errno.ENOENT and e.returncode != 128: | 443 if e.returncode != errno.ENOENT and e.returncode != 128: |
444 # ENOENT == 2 = they don't have git installed. | 444 # ENOENT == 2 = they don't have git installed. |
445 # 128 = git error code when not in a repo. | 445 # 128 = git error code when not in a repo. |
446 logging.warn('Unexpected error code: %s' % e.returncode) | 446 logging.warn('Unexpected error code: %s' % e.returncode) |
447 raise | 447 raise |
448 raise NoTryServerAccess("Could not guess version control system. " | 448 raise NoTryServerAccess("Could not guess version control system. " |
449 "Are you in a working copy directory?") | 449 "Are you in a working copy directory?") |
450 | 450 |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 except (InvalidScript, NoTryServerAccess), e: | 745 except (InvalidScript, NoTryServerAccess), e: |
746 if swallow_exception: | 746 if swallow_exception: |
747 return 1 | 747 return 1 |
748 print e | 748 print e |
749 return 1 | 749 return 1 |
750 return 0 | 750 return 0 |
751 | 751 |
752 | 752 |
753 if __name__ == "__main__": | 753 if __name__ == "__main__": |
754 sys.exit(TryChange(None, [], False)) | 754 sys.exit(TryChange(None, [], False)) |
OLD | NEW |