Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: scm.py

Issue 183283003: Another attempt: gclient: delete mismatching checkouts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Fix for unmanaged git-svn, remove commented lines Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gclient_scm.py ('k') | testing_support/fake_repos.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 """Returns the full branch reference, e.g. 'refs/heads/master'.""" 160 """Returns the full branch reference, e.g. 'refs/heads/master'."""
161 return GIT.Capture(['symbolic-ref', 'HEAD'], cwd=cwd) 161 return GIT.Capture(['symbolic-ref', 'HEAD'], cwd=cwd)
162 162
163 @staticmethod 163 @staticmethod
164 def GetBranch(cwd): 164 def GetBranch(cwd):
165 """Returns the short branch name, e.g. 'master'.""" 165 """Returns the short branch name, e.g. 'master'."""
166 return GIT.ShortBranchName(GIT.GetBranchRef(cwd)) 166 return GIT.ShortBranchName(GIT.GetBranchRef(cwd))
167 167
168 @staticmethod 168 @staticmethod
169 def IsGitSvn(cwd): 169 def IsGitSvn(cwd):
170 """Returns true if this repo looks like it's using git-svn.""" 170 """Returns True if this repo looks like it's using git-svn."""
171 # If you have any "svn-remote.*" config keys, we think you're using svn. 171 # If you have any "svn-remote.*" config keys, we think you're using svn.
172 try: 172 try:
173 GIT.Capture(['config', '--local', '--get-regexp', r'^svn-remote\.'], 173 GIT.Capture(['config', '--local', '--get-regexp', r'^svn-remote\.'],
174 cwd=cwd) 174 cwd=cwd)
175 return True 175 return True
176 except subprocess2.CalledProcessError: 176 except subprocess2.CalledProcessError:
177 return False 177 return False
178 178
179 @staticmethod 179 @staticmethod
180 def MatchSvnGlob(url, base_url, glob_spec, allow_wildcards): 180 def MatchSvnGlob(url, base_url, glob_spec, allow_wildcards):
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 # revert, like for properties. 1107 # revert, like for properties.
1108 if not os.path.isdir(cwd): 1108 if not os.path.isdir(cwd):
1109 # '.' was deleted. It's not worth continuing. 1109 # '.' was deleted. It's not worth continuing.
1110 return 1110 return
1111 try: 1111 try:
1112 SVN.Capture(['revert', file_status[1]], cwd=cwd) 1112 SVN.Capture(['revert', file_status[1]], cwd=cwd)
1113 except subprocess2.CalledProcessError: 1113 except subprocess2.CalledProcessError:
1114 if not os.path.exists(file_path): 1114 if not os.path.exists(file_path):
1115 continue 1115 continue
1116 raise 1116 raise
OLDNEW
« no previous file with comments | « gclient_scm.py ('k') | testing_support/fake_repos.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698