| OLD | NEW |
| 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """SCM-specific utility classes.""" | 5 """SCM-specific utility classes.""" |
| 6 | 6 |
| 7 import cStringIO | 7 import cStringIO |
| 8 import glob | 8 import glob |
| 9 import logging | 9 import logging |
| 10 import os | 10 import os |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 """Similar to upload.py's version but much simpler. | 69 """Similar to upload.py's version but much simpler. |
| 70 | 70 |
| 71 Returns 'svn', 'git' or None. | 71 Returns 'svn', 'git' or None. |
| 72 """ | 72 """ |
| 73 if os.path.isdir(os.path.join(root, '.svn')): | 73 if os.path.isdir(os.path.join(root, '.svn')): |
| 74 return 'svn' | 74 return 'svn' |
| 75 elif os.path.isdir(os.path.join(root, '.git')): | 75 elif os.path.isdir(os.path.join(root, '.git')): |
| 76 return 'git' | 76 return 'git' |
| 77 else: | 77 else: |
| 78 try: | 78 try: |
| 79 subprocess2.check_output( | 79 subprocess2.check_call( |
| 80 ['git', 'rev-parse', '--show-cdup'], | 80 ['git', 'rev-parse', '--show-cdup'], |
| 81 stdout=subprocess2.VOID, | 81 stdout=subprocess2.VOID, |
| 82 stderr=subprocess2.VOID, | 82 stderr=subprocess2.VOID, |
| 83 cwd=root) | 83 cwd=root) |
| 84 return 'git' | 84 return 'git' |
| 85 except (OSError, subprocess2.CalledProcessError): | 85 except (OSError, subprocess2.CalledProcessError): |
| 86 return None | 86 return None |
| 87 | 87 |
| 88 | 88 |
| 89 class GIT(object): | 89 class GIT(object): |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 if (file_status[0][0] in ('D', 'A', '!') or | 983 if (file_status[0][0] in ('D', 'A', '!') or |
| 984 not file_status[0][1:].isspace()): | 984 not file_status[0][1:].isspace()): |
| 985 # Added, deleted file requires manual intervention and require calling | 985 # Added, deleted file requires manual intervention and require calling |
| 986 # revert, like for properties. | 986 # revert, like for properties. |
| 987 try: | 987 try: |
| 988 SVN.Capture(['revert', file_status[1]], cwd=repo_root) | 988 SVN.Capture(['revert', file_status[1]], cwd=repo_root) |
| 989 except subprocess2.CalledProcessError: | 989 except subprocess2.CalledProcessError: |
| 990 if not os.path.exists(file_path): | 990 if not os.path.exists(file_path): |
| 991 continue | 991 continue |
| 992 raise | 992 raise |
| OLD | NEW |