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

Side by Side Diff: scm.py

Issue 1471973004: Fix some path processing to work better on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: lint Created 5 years 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 | « repo ('k') | no next file » | 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 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 else: 1033 else:
1034 regexp = re.compile(r'<%s:\d+> %s' % (realm, uuid)) 1034 regexp = re.compile(r'<%s:\d+> %s' % (realm, uuid))
1035 if regexp is None: 1035 if regexp is None:
1036 return None 1036 return None
1037 if sys.platform.startswith('win'): 1037 if sys.platform.startswith('win'):
1038 if not 'APPDATA' in os.environ: 1038 if not 'APPDATA' in os.environ:
1039 return None 1039 return None
1040 auth_dir = os.path.join(os.environ['APPDATA'], 'Subversion', 'auth', 1040 auth_dir = os.path.join(os.environ['APPDATA'], 'Subversion', 'auth',
1041 'svn.simple') 1041 'svn.simple')
1042 else: 1042 else:
1043 if not 'HOME' in os.environ: 1043 auth_dir = os.path.expanduser(
1044 os.path.join('~', '.subversion', 'auth', 'svn.simple'))
1045 if not os.path.exists(auth_dir):
1044 return None 1046 return None
1045 auth_dir = os.path.join(os.environ['HOME'], '.subversion', 'auth',
1046 'svn.simple')
1047 for credfile in os.listdir(auth_dir): 1047 for credfile in os.listdir(auth_dir):
1048 cred_info = SVN.ReadSimpleAuth(os.path.join(auth_dir, credfile)) 1048 cred_info = SVN.ReadSimpleAuth(os.path.join(auth_dir, credfile))
1049 if regexp.match(cred_info.get('svn:realmstring')): 1049 if regexp.match(cred_info.get('svn:realmstring')):
1050 return cred_info.get('username') 1050 return cred_info.get('username')
1051 1051
1052 @staticmethod 1052 @staticmethod
1053 def ReadSimpleAuth(filename): 1053 def ReadSimpleAuth(filename):
1054 f = open(filename, 'r') 1054 f = open(filename, 'r')
1055 values = {} 1055 values = {}
1056 def ReadOneItem(item_type): 1056 def ReadOneItem(item_type):
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 # revert, like for properties. 1170 # revert, like for properties.
1171 if not os.path.isdir(cwd): 1171 if not os.path.isdir(cwd):
1172 # '.' was deleted. It's not worth continuing. 1172 # '.' was deleted. It's not worth continuing.
1173 return 1173 return
1174 try: 1174 try:
1175 SVN.Capture(['revert', file_status[1]], cwd=cwd) 1175 SVN.Capture(['revert', file_status[1]], cwd=cwd)
1176 except subprocess2.CalledProcessError: 1176 except subprocess2.CalledProcessError:
1177 if not os.path.exists(file_path): 1177 if not os.path.exists(file_path):
1178 continue 1178 continue
1179 raise 1179 raise
OLDNEW
« no previous file with comments | « repo ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698