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

Side by Side Diff: gclient_scm.py

Issue 209963002: gclient: Fix nested checkout bug when validating .gclient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: 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 | « no previous file | 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 """Gclient-specific SCM-specific operations.""" 5 """Gclient-specific SCM-specific operations."""
6 6
7 import logging 7 import logging
8 import os 8 import os
9 import posixpath 9 import posixpath
10 import re 10 import re
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 raise gclient_utils.Error('Unknown command %s' % command) 135 raise gclient_utils.Error('Unknown command %s' % command)
136 136
137 if not command in dir(self): 137 if not command in dir(self):
138 raise gclient_utils.Error('Command %s not implemented in %s wrapper' % ( 138 raise gclient_utils.Error('Command %s not implemented in %s wrapper' % (
139 command, self.__class__.__name__)) 139 command, self.__class__.__name__))
140 140
141 return getattr(self, command)(options, args, file_list) 141 return getattr(self, command)(options, args, file_list)
142 142
143 def GetActualRemoteURL(self): 143 def GetActualRemoteURL(self):
144 """Attempt to determine the remote URL for this SCMWrapper.""" 144 """Attempt to determine the remote URL for this SCMWrapper."""
145 try: 145 if os.path.exists(os.path.join(self.checkout_path, '.git')):
146 return shlex.split(scm.GIT.Capture( 146 return shlex.split(scm.GIT.Capture(
147 ['config', '--local', '--get-regexp', r'remote.*.url'], 147 ['config', '--local', '--get-regexp', r'remote.*.url'],
148 self.checkout_path))[1] 148 self.checkout_path))[1]
149 except Exception: 149 if os.path.exists(os.path.join(self.checkout_path, '.svn')):
150 pass
151 try:
152 return scm.SVN.CaptureLocalInfo([], self.checkout_path)['URL'] 150 return scm.SVN.CaptureLocalInfo([], self.checkout_path)['URL']
153 except Exception:
154 pass
155 return None 151 return None
156 152
157 def DoesRemoteURLMatch(self): 153 def DoesRemoteURLMatch(self):
158 """Determine whether the remote URL of this checkout is the expected URL.""" 154 """Determine whether the remote URL of this checkout is the expected URL."""
159 if not os.path.exists(self.checkout_path): 155 if not os.path.exists(self.checkout_path):
160 # A checkout which doesn't exist can't be broken. 156 # A checkout which doesn't exist can't be broken.
161 return True 157 return True
162 158
163 actual_remote_url = self.GetActualRemoteURL() 159 actual_remote_url = self.GetActualRemoteURL()
164 if actual_remote_url: 160 if actual_remote_url:
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 new_command.append('--force') 1427 new_command.append('--force')
1432 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1428 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1433 new_command.extend(('--accept', 'theirs-conflict')) 1429 new_command.extend(('--accept', 'theirs-conflict'))
1434 elif options.manually_grab_svn_rev: 1430 elif options.manually_grab_svn_rev:
1435 new_command.append('--force') 1431 new_command.append('--force')
1436 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1432 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1437 new_command.extend(('--accept', 'postpone')) 1433 new_command.extend(('--accept', 'postpone'))
1438 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1434 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1439 new_command.extend(('--accept', 'postpone')) 1435 new_command.extend(('--accept', 'postpone'))
1440 return new_command 1436 return new_command
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698