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

Side by Side Diff: gclient_scm.py

Issue 164053003: Re-re-land gclient deletion of mismatching checkouts again (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Another attempt of gclient: delete mismatching checkouts 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 | gclient_utils.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 """Gclient-specific SCM-specific operations.""" 5 """Gclient-specific SCM-specific operations."""
6 6
7 import collections 7 import collections
8 import logging 8 import logging
9 import os 9 import os
10 import posixpath 10 import posixpath
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 if revision.startswith('refs/'): 295 if revision.startswith('refs/'):
296 rev_type = "branch" 296 rev_type = "branch"
297 elif revision.startswith(self.remote + '/'): 297 elif revision.startswith(self.remote + '/'):
298 # For compatibility with old naming, translate 'origin' to 'refs/heads' 298 # For compatibility with old naming, translate 'origin' to 'refs/heads'
299 revision = revision.replace(self.remote + '/', 'refs/heads/') 299 revision = revision.replace(self.remote + '/', 'refs/heads/')
300 rev_type = "branch" 300 rev_type = "branch"
301 else: 301 else:
302 # hash is also a tag, only make a distinction at checkout 302 # hash is also a tag, only make a distinction at checkout
303 rev_type = "hash" 303 rev_type = "hash"
304 304
305 if (not os.path.exists(self.checkout_path) or 305 if not managed:
306 (os.path.isdir(self.checkout_path) and 306 self._UpdateBranchHeads(options, fetch=False)
307 not os.path.exists(os.path.join(self.checkout_path, '.git')))): 307 self.UpdateSubmoduleConfig()
308 print ('________ unmanaged solution; skipping %s' % self.relpath)
309 return self._Capture(['rev-parse', '--verify', 'HEAD'])
310
311 needs_delete = False
312 exists = os.path.exists(self.checkout_path)
313 if exists and not os.path.exists(os.path.join(self.checkout_path, '.git')):
314 needs_delete = True
315
316 # See if the url has changed (the unittests use git://foo for the url, let
317 # that through).
318 return_early = False
319 if exists and not needs_delete:
320 current_url = self._Capture(['config', 'remote.%s.url' % self.remote])
321 # TODO(maruel): Delete url != 'git://foo' since it's just to make the
322 # unit test pass. (and update the comment above)
323 # Skip url auto-correction if remote.origin.gclient-auto-fix-url is set.
324 # This allows devs to use experimental repos which have a different url
325 # but whose branch(s) are the same as official repos.
326 if (current_url != url and url != 'git://foo'):
327 auto_fix = 'True'
328 try:
329 auto_fix = self._Capture(
330 ['config', 'remote.%s.gclient-auto-fix-url' % self.remote],
331 cwd=self.checkout_path).strip()
332 except subprocess2.CalledProcessError:
333 pass
334 if auto_fix in ('1', 'true', 'True', 'yes', 'Yes', 'y', 'Y'):
335 print('_____ switching %s to a new upstream' % self.relpath)
336 # Make sure it's clean
337 self._CheckClean(rev_str)
338 # Switch over to the new upstream
339 self._Run(['remote', 'set-url', self.remote, url], options)
340 self._FetchAndReset(revision, file_list, options)
341 return_early = True
342
343 if (needs_delete and
344 gclient_utils.enable_deletion_of_conflicting_checkouts()):
345 if options.force:
346 print('Conflicting directory found in %s. Removing.'
347 % self.checkout_path)
348 gclient_utils.rmtree(self.checkout_path)
349 else:
350 raise gclient_utils.Error('Conflicting directory found in %s. Please '
351 'delete it or run with --force.'
352 % self.checkout_path)
353
354 if not os.path.exists(self.checkout_path):
308 self._Clone(revision, url, options) 355 self._Clone(revision, url, options)
309 self.UpdateSubmoduleConfig() 356 self.UpdateSubmoduleConfig()
310 if file_list is not None: 357 if file_list is not None:
311 files = self._Capture(['ls-files']).splitlines() 358 files = self._Capture(['ls-files']).splitlines()
312 file_list.extend([os.path.join(self.checkout_path, f) for f in files]) 359 file_list.extend([os.path.join(self.checkout_path, f) for f in files])
313 if not verbose: 360 if not verbose:
314 # Make the output a little prettier. It's nice to have some whitespace 361 # Make the output a little prettier. It's nice to have some whitespace
315 # between projects when cloning. 362 # between projects when cloning.
316 print('') 363 print('')
317 return self._Capture(['rev-parse', '--verify', 'HEAD']) 364 return self._Capture(['rev-parse', '--verify', 'HEAD'])
318 365
319 if not managed:
320 self._UpdateBranchHeads(options, fetch=False)
321 self.UpdateSubmoduleConfig()
322 print ('________ unmanaged solution; skipping %s' % self.relpath)
323 return self._Capture(['rev-parse', '--verify', 'HEAD'])
324
325 if not os.path.exists(os.path.join(self.checkout_path, '.git')):
326 raise gclient_utils.Error('\n____ %s%s\n'
327 '\tPath is not a git repo. No .git dir.\n'
328 '\tTo resolve:\n'
329 '\t\trm -rf %s\n'
330 '\tAnd run gclient sync again\n'
331 % (self.relpath, rev_str, self.relpath))
332
333 # See if the url has changed (the unittests use git://foo for the url, let
334 # that through).
335 current_url = self._Capture(['config', 'remote.%s.url' % self.remote])
336 return_early = False
337 # TODO(maruel): Delete url != 'git://foo' since it's just to make the
338 # unit test pass. (and update the comment above)
339 # Skip url auto-correction if remote.origin.gclient-auto-fix-url is set.
340 # This allows devs to use experimental repos which have a different url
341 # but whose branch(s) are the same as official repos.
342 if (current_url != url and
343 url != 'git://foo' and
344 subprocess2.capture(
345 ['git', 'config', 'remote.%s.gclient-auto-fix-url' % self.remote],
346 cwd=self.checkout_path).strip() != 'False'):
347 print('_____ switching %s to a new upstream' % self.relpath)
348 # Make sure it's clean
349 self._CheckClean(rev_str)
350 # Switch over to the new upstream
351 self._Run(['remote', 'set-url', self.remote, url], options)
352 self._FetchAndReset(revision, file_list, options)
353 return_early = True
354
355 # Need to do this in the normal path as well as in the post-remote-switch 366 # Need to do this in the normal path as well as in the post-remote-switch
356 # path. 367 # path.
357 self._PossiblySwitchCache(url, options) 368 self._PossiblySwitchCache(url, options)
358 369
359 if return_early: 370 if return_early:
360 return self._Capture(['rev-parse', '--verify', 'HEAD']) 371 return self._Capture(['rev-parse', '--verify', 'HEAD'])
361 372
362 cur_branch = self._GetCurrentBranch() 373 cur_branch = self._GetCurrentBranch()
363 374
364 # Cases: 375 # Cases:
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 raise gclient_utils.Error( 629 raise gclient_utils.Error(
619 ( 'We could not find a valid hash for safesync_url response "%s".\n' 630 ( 'We could not find a valid hash for safesync_url response "%s".\n'
620 'Safesync URLs with a git checkout currently require the repo to\n' 631 'Safesync URLs with a git checkout currently require the repo to\n'
621 'be cloned without a safesync_url before adding the safesync_url.\n' 632 'be cloned without a safesync_url before adding the safesync_url.\n'
622 'For more info, see: ' 633 'For more info, see: '
623 'http://code.google.com/p/chromium/wiki/UsingNewGit' 634 'http://code.google.com/p/chromium/wiki/UsingNewGit'
624 '#Initial_checkout' ) % rev) 635 '#Initial_checkout' ) % rev)
625 elif rev.isdigit() and len(rev) < 7: 636 elif rev.isdigit() and len(rev) < 7:
626 # Handles an SVN rev. As an optimization, only verify an SVN revision as 637 # Handles an SVN rev. As an optimization, only verify an SVN revision as
627 # [0-9]{1,6} for now to avoid making a network request. 638 # [0-9]{1,6} for now to avoid making a network request.
628 if scm.GIT.IsGitSvn(cwd=self.checkout_path): 639 if scm.GIT.IsGitSvn(self.checkout_path):
629 local_head = scm.GIT.GetGitSvnHeadRev(cwd=self.checkout_path) 640 local_head = scm.GIT.GetGitSvnHeadRev(cwd=self.checkout_path)
630 if not local_head or local_head < int(rev): 641 if not local_head or local_head < int(rev):
631 try: 642 try:
632 logging.debug('Looking for git-svn configuration optimizations.') 643 logging.debug('Looking for git-svn configuration optimizations.')
633 if scm.GIT.Capture(['config', '--get', 'svn-remote.svn.fetch'], 644 if scm.GIT.Capture(['config', '--get', 'svn-remote.svn.fetch'],
634 cwd=self.checkout_path): 645 cwd=self.checkout_path):
635 scm.GIT.Capture(['fetch'], cwd=self.checkout_path) 646 scm.GIT.Capture(['fetch'], cwd=self.checkout_path)
636 except subprocess2.CalledProcessError: 647 except subprocess2.CalledProcessError:
637 logging.debug('git config --get svn-remote.svn.fetch failed, ' 648 logging.debug('git config --get svn-remote.svn.fetch failed, '
638 'ignoring possible optimization.') 649 'ignoring possible optimization.')
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 filter_fn=SvnDiffFilterer(self.relpath).Filter) 1108 filter_fn=SvnDiffFilterer(self.relpath).Filter)
1098 1109
1099 def update(self, options, args, file_list): 1110 def update(self, options, args, file_list):
1100 """Runs svn to update or transparently checkout the working copy. 1111 """Runs svn to update or transparently checkout the working copy.
1101 1112
1102 All updated files will be appended to file_list. 1113 All updated files will be appended to file_list.
1103 1114
1104 Raises: 1115 Raises:
1105 Error: if can't get URL for relative path. 1116 Error: if can't get URL for relative path.
1106 """ 1117 """
1107 # Only update if git or hg is not controlling the directory.
1108 git_path = os.path.join(self.checkout_path, '.git')
1109 if os.path.exists(git_path):
1110 print('________ found .git directory; skipping %s' % self.relpath)
1111 return
1112
1113 hg_path = os.path.join(self.checkout_path, '.hg')
1114 if os.path.exists(hg_path):
1115 print('________ found .hg directory; skipping %s' % self.relpath)
1116 return
1117
1118 if args: 1118 if args:
1119 raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args)) 1119 raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args))
1120 1120
1121 # revision is the revision to match. It is None if no revision is specified, 1121 # revision is the revision to match. It is None if no revision is specified,
1122 # i.e. the 'deps ain't pinned'. 1122 # i.e. the 'deps ain't pinned'.
1123 url, revision = gclient_utils.SplitUrlRevision(self.url) 1123 url, revision = gclient_utils.SplitUrlRevision(self.url)
1124 # Keep the original unpinned url for reference in case the repo is switched. 1124 # Keep the original unpinned url for reference in case the repo is switched.
1125 base_url = url 1125 base_url = url
1126 managed = True 1126 managed = True
1127 if options.revision: 1127 if options.revision:
1128 # Override the revision number. 1128 # Override the revision number.
1129 revision = str(options.revision) 1129 revision = str(options.revision)
1130 if revision: 1130 if revision:
1131 if revision != 'unmanaged': 1131 if revision != 'unmanaged':
1132 forced_revision = True 1132 forced_revision = True
1133 # Reconstruct the url. 1133 # Reconstruct the url.
1134 url = '%s@%s' % (url, revision) 1134 url = '%s@%s' % (url, revision)
1135 rev_str = ' at %s' % revision 1135 rev_str = ' at %s' % revision
1136 else: 1136 else:
1137 managed = False 1137 managed = False
1138 revision = None 1138 revision = None
1139 else: 1139 else:
1140 forced_revision = False 1140 forced_revision = False
1141 rev_str = '' 1141 rev_str = ''
1142 1142
1143 if not managed:
1144 print ('________ unmanaged solution; skipping %s' % self.relpath)
1145 return self.Svnversion()
1146
1143 # Get the existing scm url and the revision number of the current checkout. 1147 # Get the existing scm url and the revision number of the current checkout.
1144 exists = os.path.exists(self.checkout_path) 1148 exists = os.path.exists(self.checkout_path)
1145 if exists and managed: 1149 needs_delete = False
1150 from_info = None
1151
1152 if exists:
1153 # If there's a git-svn checkout, verify that the svn-remote is correct.
1154 if scm.GIT.IsGitSvn(self.checkout_path):
1155 remote_url = scm.GIT.Capture(['config', '--local', '--get',
1156 'svn-remote.svn.url'],
1157 cwd=self.checkout_path).rstrip()
1158 if remote_url != base_url:
1159 needs_delete = True
1160 else:
1161 print('\n_____ %s looks like a git-svn checkout. Skipping.'
1162 % self.relpath)
1163 return # TODO(borenet): Get the svn revision number?
1164
1146 try: 1165 try:
1147 from_info = scm.SVN.CaptureLocalInfo( 1166 from_info = scm.SVN.CaptureLocalInfo(
1148 [], os.path.join(self.checkout_path, '.')) 1167 [], os.path.join(self.checkout_path, '.'))
1149 except (gclient_utils.Error, subprocess2.CalledProcessError): 1168 except (gclient_utils.Error, subprocess2.CalledProcessError):
1150 if options.reset and options.delete_unversioned_trees: 1169 if gclient_utils.enable_deletion_of_conflicting_checkouts():
1151 print 'Removing troublesome path %s' % self.checkout_path 1170 needs_delete = True
1152 gclient_utils.rmtree(self.checkout_path) 1171 else: # TODO(borenet): Remove this once we can get rid of the guard.
1153 exists = False 1172 if options.reset and options.delete_unversioned_trees:
1154 else: 1173 print 'Removing troublesome path %s' % self.checkout_path
1155 msg = ('Can\'t update/checkout %s if an unversioned directory is ' 1174 gclient_utils.rmtree(self.checkout_path)
1156 'present. Delete the directory and try again.') 1175 exists = False
1157 raise gclient_utils.Error(msg % self.checkout_path) 1176 else:
1177 msg = ('Can\'t update/checkout %s if an unversioned directory is '
1178 'present. Delete the directory and try again.')
1179 raise gclient_utils.Error(msg % self.checkout_path)
1180
1181 # Switch the checkout if necessary.
1182 if not needs_delete and from_info and from_info['URL'] != base_url:
1183 # The repository url changed, need to switch.
1184 try:
1185 to_info = scm.SVN.CaptureRemoteInfo(url)
1186 except (gclient_utils.Error, subprocess2.CalledProcessError):
1187 # The url is invalid or the server is not accessible, it's safer to bail
1188 # out right now.
1189 raise gclient_utils.Error('This url is unreachable: %s' % url)
1190 can_switch = ((from_info['Repository Root'] != to_info['Repository Root'])
1191 and (from_info['UUID'] == to_info['UUID']))
1192 if can_switch:
1193 print('\n_____ relocating %s to a new checkout' % self.relpath)
1194 # We have different roots, so check if we can switch --relocate.
1195 # Subversion only permits this if the repository UUIDs match.
1196 # Perform the switch --relocate, then rewrite the from_url
1197 # to reflect where we "are now." (This is the same way that
1198 # Subversion itself handles the metadata when switch --relocate
1199 # is used.) This makes the checks below for whether we
1200 # can update to a revision or have to switch to a different
1201 # branch work as expected.
1202 # TODO(maruel): TEST ME !
1203 command = ['switch', '--relocate',
1204 from_info['Repository Root'],
1205 to_info['Repository Root'],
1206 self.relpath]
1207 self._Run(command, options, cwd=self._root_dir)
1208 from_info['URL'] = from_info['URL'].replace(
1209 from_info['Repository Root'],
1210 to_info['Repository Root'])
1211 else:
1212 needs_delete = True
1213
1214 if (needs_delete and
1215 gclient_utils.enable_deletion_of_conflicting_checkouts()):
1216 if options.force:
1217 gclient_utils.rmtree(self.checkout_path)
1218 exists = False
1219 else:
1220 raise gclient_utils.Error('Conflicting directory found in %s. Please '
1221 'delete it or run with --force.'
1222 % self.checkout_path)
1158 1223
1159 BASE_URLS = { 1224 BASE_URLS = {
1160 '/chrome/trunk/src': 'gs://chromium-svn-checkout/chrome/', 1225 '/chrome/trunk/src': 'gs://chromium-svn-checkout/chrome/',
1161 '/blink/trunk': 'gs://chromium-svn-checkout/blink/', 1226 '/blink/trunk': 'gs://chromium-svn-checkout/blink/',
1162 } 1227 }
1163 WHITELISTED_ROOTS = [ 1228 WHITELISTED_ROOTS = [
1164 'svn://svn.chromium.org', 1229 'svn://svn.chromium.org',
1165 'svn://svn-mirror.golo.chromium.org', 1230 'svn://svn-mirror.golo.chromium.org',
1166 ] 1231 ]
1167 if not exists: 1232 if not exists:
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 print 'Resuming normal operations.' 1290 print 'Resuming normal operations.'
1226 print str(e) 1291 print str(e)
1227 1292
1228 gclient_utils.safe_makedirs(os.path.dirname(self.checkout_path)) 1293 gclient_utils.safe_makedirs(os.path.dirname(self.checkout_path))
1229 # We need to checkout. 1294 # We need to checkout.
1230 command = ['checkout', url, self.checkout_path] 1295 command = ['checkout', url, self.checkout_path]
1231 command = self._AddAdditionalUpdateFlags(command, options, revision) 1296 command = self._AddAdditionalUpdateFlags(command, options, revision)
1232 self._RunAndGetFileList(command, options, file_list, self._root_dir) 1297 self._RunAndGetFileList(command, options, file_list, self._root_dir)
1233 return self.Svnversion() 1298 return self.Svnversion()
1234 1299
1235 if not managed:
1236 print ('________ unmanaged solution; skipping %s' % self.relpath)
1237 return self.Svnversion()
1238
1239 if 'URL' not in from_info: 1300 if 'URL' not in from_info:
1240 raise gclient_utils.Error( 1301 raise gclient_utils.Error(
1241 ('gclient is confused. Couldn\'t get the url for %s.\n' 1302 ('gclient is confused. Couldn\'t get the url for %s.\n'
1242 'Try using @unmanaged.\n%s') % ( 1303 'Try using @unmanaged.\n%s') % (
1243 self.checkout_path, from_info)) 1304 self.checkout_path, from_info))
1244 1305
1245 # Look for locked directories. 1306 # Look for locked directories.
1246 dir_info = scm.SVN.CaptureStatus( 1307 dir_info = scm.SVN.CaptureStatus(
1247 None, os.path.join(self.checkout_path, '.')) 1308 None, os.path.join(self.checkout_path, '.'))
1248 if any(d[0][2] == 'L' for d in dir_info): 1309 if any(d[0][2] == 'L' for d in dir_info):
(...skipping 21 matching lines...) Expand all
1270 if d[0][0] == '!': 1331 if d[0][0] == '!':
1271 print 'You can pass --force to enable automatic removal.' 1332 print 'You can pass --force to enable automatic removal.'
1272 raise e 1333 raise e
1273 1334
1274 # Retrieve the current HEAD version because svn is slow at null updates. 1335 # Retrieve the current HEAD version because svn is slow at null updates.
1275 if options.manually_grab_svn_rev and not revision: 1336 if options.manually_grab_svn_rev and not revision:
1276 from_info_live = scm.SVN.CaptureRemoteInfo(from_info['URL']) 1337 from_info_live = scm.SVN.CaptureRemoteInfo(from_info['URL'])
1277 revision = str(from_info_live['Revision']) 1338 revision = str(from_info_live['Revision'])
1278 rev_str = ' at %s' % revision 1339 rev_str = ' at %s' % revision
1279 1340
1280 if from_info['URL'] != base_url:
1281 # The repository url changed, need to switch.
1282 try:
1283 to_info = scm.SVN.CaptureRemoteInfo(url)
1284 except (gclient_utils.Error, subprocess2.CalledProcessError):
1285 # The url is invalid or the server is not accessible, it's safer to bail
1286 # out right now.
1287 raise gclient_utils.Error('This url is unreachable: %s' % url)
1288 can_switch = ((from_info['Repository Root'] != to_info['Repository Root'])
1289 and (from_info['UUID'] == to_info['UUID']))
1290 if can_switch:
1291 print('\n_____ relocating %s to a new checkout' % self.relpath)
1292 # We have different roots, so check if we can switch --relocate.
1293 # Subversion only permits this if the repository UUIDs match.
1294 # Perform the switch --relocate, then rewrite the from_url
1295 # to reflect where we "are now." (This is the same way that
1296 # Subversion itself handles the metadata when switch --relocate
1297 # is used.) This makes the checks below for whether we
1298 # can update to a revision or have to switch to a different
1299 # branch work as expected.
1300 # TODO(maruel): TEST ME !
1301 command = ['switch', '--relocate',
1302 from_info['Repository Root'],
1303 to_info['Repository Root'],
1304 self.relpath]
1305 self._Run(command, options, cwd=self._root_dir)
1306 from_info['URL'] = from_info['URL'].replace(
1307 from_info['Repository Root'],
1308 to_info['Repository Root'])
1309 else:
1310 if not options.force and not options.reset:
1311 # Look for local modifications but ignore unversioned files.
1312 for status in scm.SVN.CaptureStatus(None, self.checkout_path):
1313 if status[0][0] != '?':
1314 raise gclient_utils.Error(
1315 ('Can\'t switch the checkout to %s; UUID don\'t match and '
1316 'there is local changes in %s. Delete the directory and '
1317 'try again.') % (url, self.checkout_path))
1318 # Ok delete it.
1319 print('\n_____ switching %s to a new checkout' % self.relpath)
1320 gclient_utils.rmtree(self.checkout_path)
1321 # We need to checkout.
1322 command = ['checkout', url, self.checkout_path]
1323 command = self._AddAdditionalUpdateFlags(command, options, revision)
1324 self._RunAndGetFileList(command, options, file_list, self._root_dir)
1325 return self.Svnversion()
1326
1327 # If the provided url has a revision number that matches the revision 1341 # If the provided url has a revision number that matches the revision
1328 # number of the existing directory, then we don't need to bother updating. 1342 # number of the existing directory, then we don't need to bother updating.
1329 if not options.force and str(from_info['Revision']) == revision: 1343 if not options.force and str(from_info['Revision']) == revision:
1330 if options.verbose or not forced_revision: 1344 if options.verbose or not forced_revision:
1331 print('\n_____ %s%s' % (self.relpath, rev_str)) 1345 print('\n_____ %s%s' % (self.relpath, rev_str))
1332 else: 1346 else:
1333 command = ['update', self.checkout_path] 1347 command = ['update', self.checkout_path]
1334 command = self._AddAdditionalUpdateFlags(command, options, revision) 1348 command = self._AddAdditionalUpdateFlags(command, options, revision)
1335 self._RunAndGetFileList(command, options, file_list, self._root_dir) 1349 self._RunAndGetFileList(command, options, file_list, self._root_dir)
1336 1350
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 # svn revert won't work if the directory doesn't exist. It needs to 1400 # svn revert won't work if the directory doesn't exist. It needs to
1387 # checkout instead. 1401 # checkout instead.
1388 print('\n_____ %s is missing, synching instead' % self.relpath) 1402 print('\n_____ %s is missing, synching instead' % self.relpath)
1389 # Don't reuse the args. 1403 # Don't reuse the args.
1390 return self.update(options, [], file_list) 1404 return self.update(options, [], file_list)
1391 1405
1392 if not os.path.isdir(os.path.join(self.checkout_path, '.svn')): 1406 if not os.path.isdir(os.path.join(self.checkout_path, '.svn')):
1393 if os.path.isdir(os.path.join(self.checkout_path, '.git')): 1407 if os.path.isdir(os.path.join(self.checkout_path, '.git')):
1394 print('________ found .git directory; skipping %s' % self.relpath) 1408 print('________ found .git directory; skipping %s' % self.relpath)
1395 return 1409 return
1396 if os.path.isdir(os.path.join(self.checkout_path, '.hg')):
1397 print('________ found .hg directory; skipping %s' % self.relpath)
1398 return
1399 if not options.force: 1410 if not options.force:
1400 raise gclient_utils.Error('Invalid checkout path, aborting') 1411 raise gclient_utils.Error('Invalid checkout path, aborting')
1401 print( 1412 print(
1402 '\n_____ %s is not a valid svn checkout, synching instead' % 1413 '\n_____ %s is not a valid svn checkout, synching instead' %
1403 self.relpath) 1414 self.relpath)
1404 gclient_utils.rmtree(self.checkout_path) 1415 gclient_utils.rmtree(self.checkout_path)
1405 # Don't reuse the args. 1416 # Don't reuse the args.
1406 return self.update(options, [], file_list) 1417 return self.update(options, [], file_list)
1407 1418
1408 def printcb(file_status): 1419 def printcb(file_status):
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1506 new_command.append('--force') 1517 new_command.append('--force')
1507 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1518 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1508 new_command.extend(('--accept', 'theirs-conflict')) 1519 new_command.extend(('--accept', 'theirs-conflict'))
1509 elif options.manually_grab_svn_rev: 1520 elif options.manually_grab_svn_rev:
1510 new_command.append('--force') 1521 new_command.append('--force')
1511 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1522 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1512 new_command.extend(('--accept', 'postpone')) 1523 new_command.extend(('--accept', 'postpone'))
1513 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1524 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1514 new_command.extend(('--accept', 'postpone')) 1525 new_command.extend(('--accept', 'postpone'))
1515 return new_command 1526 return new_command
OLDNEW
« no previous file with comments | « no previous file | gclient_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698