| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 """Returns the full branch reference, e.g. 'refs/heads/master'.""" | 164 """Returns the full branch reference, e.g. 'refs/heads/master'.""" |
| 165 return GIT.Capture(['symbolic-ref', 'HEAD'], cwd=cwd) | 165 return GIT.Capture(['symbolic-ref', 'HEAD'], cwd=cwd) |
| 166 | 166 |
| 167 @staticmethod | 167 @staticmethod |
| 168 def GetBranch(cwd): | 168 def GetBranch(cwd): |
| 169 """Returns the short branch name, e.g. 'master'.""" | 169 """Returns the short branch name, e.g. 'master'.""" |
| 170 return GIT.ShortBranchName(GIT.GetBranchRef(cwd)) | 170 return GIT.ShortBranchName(GIT.GetBranchRef(cwd)) |
| 171 | 171 |
| 172 @staticmethod | 172 @staticmethod |
| 173 def IsGitSvn(cwd): | 173 def IsGitSvn(cwd): |
| 174 """Returns true if this repo looks like it's using git-svn.""" | 174 """Returns True if this repo looks like it's using git-svn.""" |
| 175 # If you have any "svn-remote.*" config keys, we think you're using svn. | 175 # If you have any "svn-remote.*" config keys, we think you're using svn. |
| 176 try: | 176 try: |
| 177 GIT.Capture(['config', '--local', '--get-regexp', r'^svn-remote\.'], | 177 GIT.Capture(['config', '--local', '--get-regexp', r'^svn-remote\.'], |
| 178 cwd=cwd) | 178 cwd=cwd) |
| 179 return True | 179 return True |
| 180 except subprocess2.CalledProcessError: | 180 except subprocess2.CalledProcessError: |
| 181 return False | 181 return False |
| 182 | 182 |
| 183 @staticmethod | 183 @staticmethod |
| 184 def MatchSvnGlob(url, base_url, glob_spec, allow_wildcards): | 184 def MatchSvnGlob(url, base_url, glob_spec, allow_wildcards): |
| (...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1122 # revert, like for properties. | 1122 # revert, like for properties. |
| 1123 if not os.path.isdir(cwd): | 1123 if not os.path.isdir(cwd): |
| 1124 # '.' was deleted. It's not worth continuing. | 1124 # '.' was deleted. It's not worth continuing. |
| 1125 return | 1125 return |
| 1126 try: | 1126 try: |
| 1127 SVN.Capture(['revert', file_status[1]], cwd=cwd) | 1127 SVN.Capture(['revert', file_status[1]], cwd=cwd) |
| 1128 except subprocess2.CalledProcessError: | 1128 except subprocess2.CalledProcessError: |
| 1129 if not os.path.exists(file_path): | 1129 if not os.path.exists(file_path): |
| 1130 continue | 1130 continue |
| 1131 raise | 1131 raise |
| OLD | NEW |