| 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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 logging.info("GuessVCS(%s)" % path) | 435 logging.info("GuessVCS(%s)" % path) |
| 436 # Subversion has a .svn in all working directories. | 436 # Subversion has a .svn in all working directories. |
| 437 if os.path.isdir(os.path.join(real_path, '.svn')): | 437 if os.path.isdir(os.path.join(real_path, '.svn')): |
| 438 return SVN(options, path) | 438 return SVN(options, path) |
| 439 | 439 |
| 440 # Git has a command to test if you're in a git tree. | 440 # Git has a command to test if you're in a git tree. |
| 441 # Try running it, but don't die if we don't have git installed. | 441 # Try running it, but don't die if we don't have git installed. |
| 442 try: | 442 try: |
| 443 subprocess2.check_output( | 443 subprocess2.check_output( |
| 444 ['git', 'rev-parse', '--is-inside-work-tree'], cwd=real_path, | 444 ['git', 'rev-parse', '--is-inside-work-tree'], cwd=real_path, |
| 445 stdout=subprocess2.VOID) | 445 stderr=subprocess2.VOID) |
| 446 return GIT(options, path) | 446 return GIT(options, path) |
| 447 except subprocess2.CalledProcessError, e: | 447 except subprocess2.CalledProcessError, e: |
| 448 if e.returncode != errno.ENOENT and e.returncode != 128: | 448 if e.returncode != errno.ENOENT and e.returncode != 128: |
| 449 # ENOENT == 2 = they don't have git installed. | 449 # ENOENT == 2 = they don't have git installed. |
| 450 # 128 = git error code when not in a repo. | 450 # 128 = git error code when not in a repo. |
| 451 logging.warning('Unexpected error code: %s' % e.returncode) | 451 logging.warning('Unexpected error code: %s' % e.returncode) |
| 452 raise | 452 raise |
| 453 raise NoTryServerAccess("Could not guess version control system. " | 453 raise NoTryServerAccess("Could not guess version control system. " |
| 454 "Are you in a working copy directory?") | 454 "Are you in a working copy directory?") |
| 455 | 455 |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 return 1 | 761 return 1 |
| 762 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 762 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
| 763 print >> sys.stderr, e | 763 print >> sys.stderr, e |
| 764 return 1 | 764 return 1 |
| 765 return 0 | 765 return 0 |
| 766 | 766 |
| 767 | 767 |
| 768 if __name__ == "__main__": | 768 if __name__ == "__main__": |
| 769 fix_encoding.fix_encoding() | 769 fix_encoding.fix_encoding() |
| 770 sys.exit(TryChange(None, [], False)) | 770 sys.exit(TryChange(None, [], False)) |
| OLD | NEW |