Chromium Code Reviews| 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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 423 if os.path.isdir(os.path.join(real_path, '.svn')): | 423 if os.path.isdir(os.path.join(real_path, '.svn')): |
| 424 return SVN(options, path) | 424 return SVN(options, path) |
| 425 | 425 |
| 426 # Git has a command to test if you're in a git tree. | 426 # Git has a command to test if you're in a git tree. |
| 427 # Try running it, but don't die if we don't have git installed. | 427 # Try running it, but don't die if we don't have git installed. |
| 428 try: | 428 try: |
| 429 gclient_utils.CheckCall(["git", "rev-parse", "--is-inside-work-tree"], | 429 gclient_utils.CheckCall(["git", "rev-parse", "--is-inside-work-tree"], |
| 430 real_path) | 430 real_path) |
| 431 return GIT(options, path) | 431 return GIT(options, path) |
| 432 except gclient_utils.CheckCallError, e: | 432 except gclient_utils.CheckCallError, e: |
| 433 if e.retcode != errno.ENOENT and e.retcode != 128: | 433 if e.returncode != errno.ENOENT and e.returncode != 128: |
| 434 # ENOENT == 2 = they don't have git installed. | 434 # ENOENT == 2 = they don't have git installed. |
| 435 # 128 = git error code when not in a repo. | 435 # 128 = git error code when not in a repo. |
| 436 logging.warn(e.retcode) | 436 logging.warn(e.returncode) |
|
bradn
2010/09/03 20:31:02
Maybe a real message?
| |
| 437 raise | 437 raise |
| 438 raise NoTryServerAccess("Could not guess version control system. " | 438 raise NoTryServerAccess("Could not guess version control system. " |
| 439 "Are you in a working copy directory?") | 439 "Are you in a working copy directory?") |
| 440 | 440 |
| 441 | 441 |
| 442 def GetMungedDiff(path_diff, diff): | 442 def GetMungedDiff(path_diff, diff): |
| 443 # Munge paths to match svn. | 443 # Munge paths to match svn. |
| 444 for i in range(len(diff)): | 444 for i in range(len(diff)): |
| 445 if diff[i].startswith('--- ') or diff[i].startswith('+++ '): | 445 if diff[i].startswith('--- ') or diff[i].startswith('+++ '): |
| 446 new_file = posixpath.join(path_diff, diff[i][4:]).replace('\\', '/') | 446 new_file = posixpath.join(path_diff, diff[i][4:]).replace('\\', '/') |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 735 except (InvalidScript, NoTryServerAccess), e: | 735 except (InvalidScript, NoTryServerAccess), e: |
| 736 if swallow_exception: | 736 if swallow_exception: |
| 737 return 1 | 737 return 1 |
| 738 print e | 738 print e |
| 739 return 1 | 739 return 1 |
| 740 return 0 | 740 return 0 |
| 741 | 741 |
| 742 | 742 |
| 743 if __name__ == "__main__": | 743 if __name__ == "__main__": |
| 744 sys.exit(TryChange(None, [], False)) | 744 sys.exit(TryChange(None, [], False)) |
| OLD | NEW |