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

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: Guard, pt2 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') | scm.py » ('J')
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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 if revision.startswith('refs/'): 333 if revision.startswith('refs/'):
334 rev_type = "branch" 334 rev_type = "branch"
335 elif revision.startswith(self.remote + '/'): 335 elif revision.startswith(self.remote + '/'):
336 # For compatibility with old naming, translate 'origin' to 'refs/heads' 336 # For compatibility with old naming, translate 'origin' to 'refs/heads'
337 revision = revision.replace(self.remote + '/', 'refs/heads/') 337 revision = revision.replace(self.remote + '/', 'refs/heads/')
338 rev_type = "branch" 338 rev_type = "branch"
339 else: 339 else:
340 # hash is also a tag, only make a distinction at checkout 340 # hash is also a tag, only make a distinction at checkout
341 rev_type = "hash" 341 rev_type = "hash"
342 342
343 if (not os.path.exists(self.checkout_path) or 343 if not managed:
344 (os.path.isdir(self.checkout_path) and 344 self._UpdateBranchHeads(options, fetch=False)
345 not os.path.exists(os.path.join(self.checkout_path, '.git')))): 345 self.UpdateSubmoduleConfig()
346 print ('________ unmanaged solution; skipping %s' % self.relpath)
347 return self._Capture(['rev-parse', '--verify', 'HEAD'])
348
349 needs_delete = False
350 exists = os.path.exists(self.checkout_path)
351 if exists and not os.path.exists(os.path.join(self.checkout_path, '.git')):
352 needs_delete = True
353
354 # See if the url has changed (the unittests use git://foo for the url, let
355 # that through).
356 return_early = False
357 if exists and not needs_delete:
358 current_url = self._Capture(['config', 'remote.%s.url' % self.remote])
359 # TODO(maruel): Delete url != 'git://foo' since it's just to make the
360 # unit test pass. (and update the comment above)
361 # Skip url auto-correction if remote.origin.gclient-auto-fix-url is set.
362 # This allows devs to use experimental repos which have a different url
363 # but whose branch(s) are the same as official repos.
364 if (current_url != url and
365 url != 'git://foo'):
366 if subprocess2.capture(
szager1 2014/02/25 23:32:56 self._Capture ?
borenet 2014/02/26 14:26:35 This block is just moved and slightly modified fro
szager1 2014/02/26 20:33:15 Actually, I think this is the ideal time to improv
borenet 2014/02/26 21:18:20 Ok. I was trying to be non-intrusive.
367 ['git', 'config', 'remote.%s.gclient-auto-fix-url' % self.remote],
368 cwd=self.checkout_path).strip() != 'False':
szager1 2014/02/25 23:32:56 Check for more standard boolean strings, e.g., '0'
borenet 2014/02/26 14:26:35 Again, this is just moved from below. I can chang
szager1 2014/02/26 20:33:15 Same comment, it should be easy to make the behavi
369 print('_____ switching %s to a new upstream' % self.relpath)
370 # Make sure it's clean
371 self._CheckClean(rev_str)
372 # Switch over to the new upstream
373 self._Run(['remote', 'set-url', self.remote, url], options)
374 self._FetchAndReset(revision, file_list, options)
375 return_early = True
376 else:
377 needs_delete = True
szager1 2014/02/25 23:32:56 Let me make sure I understand this... If the url
borenet 2014/02/26 14:26:35 What's the expected behavior in that case? It see
szager1 2014/02/26 20:33:15 I don't know what the expected behavior is; but se
borenet 2014/02/26 21:18:20 Changed this a bit: if gclient-auto-fix-url is not
378
379 if (needs_delete and
380 gclient_utils.enable_deletion_of_conflicting_checkouts()):
381 if options.force:
382 print('Conflicting directory found in %s. Removing.'
383 % self.checkout_path)
384 gclient_utils.rmtree(self.checkout_path)
385 else:
386 raise gclient_utils.Error('Conflicting directory found in %s. Please '
387 'delete it or run with --force.'
388 % self.checkout_path)
389
390 if not os.path.exists(self.checkout_path):
346 self._Clone(revision, url, options) 391 self._Clone(revision, url, options)
347 self.UpdateSubmoduleConfig() 392 self.UpdateSubmoduleConfig()
348 if file_list is not None: 393 if file_list is not None:
349 files = self._Capture(['ls-files']).splitlines() 394 files = self._Capture(['ls-files']).splitlines()
350 file_list.extend([os.path.join(self.checkout_path, f) for f in files]) 395 file_list.extend([os.path.join(self.checkout_path, f) for f in files])
351 if not verbose: 396 if not verbose:
352 # Make the output a little prettier. It's nice to have some whitespace 397 # Make the output a little prettier. It's nice to have some whitespace
353 # between projects when cloning. 398 # between projects when cloning.
354 print('') 399 print('')
355 return self._Capture(['rev-parse', '--verify', 'HEAD']) 400 return self._Capture(['rev-parse', '--verify', 'HEAD'])
356 401
357 if not managed:
358 self._UpdateBranchHeads(options, fetch=False)
359 self.UpdateSubmoduleConfig()
360 print ('________ unmanaged solution; skipping %s' % self.relpath)
361 return self._Capture(['rev-parse', '--verify', 'HEAD'])
362
363 if not os.path.exists(os.path.join(self.checkout_path, '.git')):
364 raise gclient_utils.Error('\n____ %s%s\n'
365 '\tPath is not a git repo. No .git dir.\n'
366 '\tTo resolve:\n'
367 '\t\trm -rf %s\n'
368 '\tAnd run gclient sync again\n'
369 % (self.relpath, rev_str, self.relpath))
370
371 # See if the url has changed (the unittests use git://foo for the url, let
372 # that through).
373 current_url = self._Capture(['config', 'remote.%s.url' % self.remote])
374 return_early = False
375 # TODO(maruel): Delete url != 'git://foo' since it's just to make the
376 # unit test pass. (and update the comment above)
377 # Skip url auto-correction if remote.origin.gclient-auto-fix-url is set.
378 # This allows devs to use experimental repos which have a different url
379 # but whose branch(s) are the same as official repos.
380 if (current_url != url and
381 url != 'git://foo' and
382 subprocess2.capture(
383 ['git', 'config', 'remote.%s.gclient-auto-fix-url' % self.remote],
384 cwd=self.checkout_path).strip() != 'False'):
385 print('_____ switching %s to a new upstream' % self.relpath)
386 # Make sure it's clean
387 self._CheckClean(rev_str)
388 # Switch over to the new upstream
389 self._Run(['remote', 'set-url', self.remote, url], options)
390 self._FetchAndReset(revision, file_list, options)
391 return_early = True
392
393 # Need to do this in the normal path as well as in the post-remote-switch 402 # Need to do this in the normal path as well as in the post-remote-switch
394 # path. 403 # path.
395 self._PossiblySwitchCache(url, options) 404 self._PossiblySwitchCache(url, options)
396 405
397 if return_early: 406 if return_early:
398 return self._Capture(['rev-parse', '--verify', 'HEAD']) 407 return self._Capture(['rev-parse', '--verify', 'HEAD'])
399 408
400 cur_branch = self._GetCurrentBranch() 409 cur_branch = self._GetCurrentBranch()
401 410
402 # Cases: 411 # Cases:
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 raise gclient_utils.Error( 665 raise gclient_utils.Error(
657 ( 'We could not find a valid hash for safesync_url response "%s".\n' 666 ( 'We could not find a valid hash for safesync_url response "%s".\n'
658 'Safesync URLs with a git checkout currently require the repo to\n' 667 'Safesync URLs with a git checkout currently require the repo to\n'
659 'be cloned without a safesync_url before adding the safesync_url.\n' 668 'be cloned without a safesync_url before adding the safesync_url.\n'
660 'For more info, see: ' 669 'For more info, see: '
661 'http://code.google.com/p/chromium/wiki/UsingNewGit' 670 'http://code.google.com/p/chromium/wiki/UsingNewGit'
662 '#Initial_checkout' ) % rev) 671 '#Initial_checkout' ) % rev)
663 elif rev.isdigit() and len(rev) < 7: 672 elif rev.isdigit() and len(rev) < 7:
664 # Handles an SVN rev. As an optimization, only verify an SVN revision as 673 # Handles an SVN rev. As an optimization, only verify an SVN revision as
665 # [0-9]{1,6} for now to avoid making a network request. 674 # [0-9]{1,6} for now to avoid making a network request.
666 if scm.GIT.IsGitSvn(cwd=self.checkout_path): 675 if scm.GIT.IsGitSvn(self.checkout_path):
667 local_head = scm.GIT.GetGitSvnHeadRev(cwd=self.checkout_path) 676 local_head = scm.GIT.GetGitSvnHeadRev(cwd=self.checkout_path)
668 if not local_head or local_head < int(rev): 677 if not local_head or local_head < int(rev):
669 try: 678 try:
670 logging.debug('Looking for git-svn configuration optimizations.') 679 logging.debug('Looking for git-svn configuration optimizations.')
671 if scm.GIT.Capture(['config', '--get', 'svn-remote.svn.fetch'], 680 if scm.GIT.Capture(['config', '--get', 'svn-remote.svn.fetch'],
672 cwd=self.checkout_path): 681 cwd=self.checkout_path):
673 scm.GIT.Capture(['fetch'], cwd=self.checkout_path) 682 scm.GIT.Capture(['fetch'], cwd=self.checkout_path)
674 except subprocess2.CalledProcessError: 683 except subprocess2.CalledProcessError:
675 logging.debug('git config --get svn-remote.svn.fetch failed, ' 684 logging.debug('git config --get svn-remote.svn.fetch failed, '
676 'ignoring possible optimization.') 685 'ignoring possible optimization.')
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 filter_fn=SvnDiffFilterer(self.relpath).Filter) 1144 filter_fn=SvnDiffFilterer(self.relpath).Filter)
1136 1145
1137 def update(self, options, args, file_list): 1146 def update(self, options, args, file_list):
1138 """Runs svn to update or transparently checkout the working copy. 1147 """Runs svn to update or transparently checkout the working copy.
1139 1148
1140 All updated files will be appended to file_list. 1149 All updated files will be appended to file_list.
1141 1150
1142 Raises: 1151 Raises:
1143 Error: if can't get URL for relative path. 1152 Error: if can't get URL for relative path.
1144 """ 1153 """
1145 # Only update if git or hg is not controlling the directory.
1146 git_path = os.path.join(self.checkout_path, '.git')
1147 if os.path.exists(git_path):
1148 print('________ found .git directory; skipping %s' % self.relpath)
1149 return
1150
1151 hg_path = os.path.join(self.checkout_path, '.hg')
1152 if os.path.exists(hg_path):
1153 print('________ found .hg directory; skipping %s' % self.relpath)
1154 return
1155
1156 if args: 1154 if args:
1157 raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args)) 1155 raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args))
1158 1156
1159 # revision is the revision to match. It is None if no revision is specified, 1157 # revision is the revision to match. It is None if no revision is specified,
1160 # i.e. the 'deps ain't pinned'. 1158 # i.e. the 'deps ain't pinned'.
1161 url, revision = gclient_utils.SplitUrlRevision(self.url) 1159 url, revision = gclient_utils.SplitUrlRevision(self.url)
1162 # Keep the original unpinned url for reference in case the repo is switched. 1160 # Keep the original unpinned url for reference in case the repo is switched.
1163 base_url = url 1161 base_url = url
1164 managed = True 1162 managed = True
1165 if options.revision: 1163 if options.revision:
1166 # Override the revision number. 1164 # Override the revision number.
1167 revision = str(options.revision) 1165 revision = str(options.revision)
1168 if revision: 1166 if revision:
1169 if revision != 'unmanaged': 1167 if revision != 'unmanaged':
1170 forced_revision = True 1168 forced_revision = True
1171 # Reconstruct the url. 1169 # Reconstruct the url.
1172 url = '%s@%s' % (url, revision) 1170 url = '%s@%s' % (url, revision)
1173 rev_str = ' at %s' % revision 1171 rev_str = ' at %s' % revision
1174 else: 1172 else:
1175 managed = False 1173 managed = False
1176 revision = None 1174 revision = None
1177 else: 1175 else:
1178 forced_revision = False 1176 forced_revision = False
1179 rev_str = '' 1177 rev_str = ''
1180 1178
1179 if not managed:
1180 print ('________ unmanaged solution; skipping %s' % self.relpath)
1181 return self.Svnversion()
1182
1181 # Get the existing scm url and the revision number of the current checkout. 1183 # Get the existing scm url and the revision number of the current checkout.
1182 exists = os.path.exists(self.checkout_path) 1184 exists = os.path.exists(self.checkout_path)
1183 if exists and managed: 1185 needs_delete = False
1186 from_info = None
1187
1188 if exists:
1189 # If there's a git-svn checkout, verify that the svn-remote is correct.
1190 if scm.GIT.IsGitSvn(self.checkout_path):
szager1 2014/02/25 23:32:56 I read the previous comments on this, I understand
borenet 2014/02/26 14:26:35 Yep.
1191 remote_url = scm.GIT.Capture(['config', '--local', '--get',
1192 'svn-remote.svn.url'],
1193 cwd=self.checkout_path).rstrip()
1194 if remote_url != base_url:
1195 needs_delete = True
1196 else:
1197 print('\n_____ %s looks like a git-svn checkout. Skipping.'
1198 % self.relpath)
1199 return # TODO(borenet): Get the svn revision number?
1200
1184 try: 1201 try:
1185 from_info = scm.SVN.CaptureLocalInfo( 1202 from_info = scm.SVN.CaptureLocalInfo(
1186 [], os.path.join(self.checkout_path, '.')) 1203 [], os.path.join(self.checkout_path, '.'))
1187 except (gclient_utils.Error, subprocess2.CalledProcessError): 1204 except (gclient_utils.Error, subprocess2.CalledProcessError):
1188 if options.reset and options.delete_unversioned_trees: 1205 if gclient_utils.enable_deletion_of_conflicting_checkouts():
1189 print 'Removing troublesome path %s' % self.checkout_path 1206 needs_delete = True
1190 gclient_utils.rmtree(self.checkout_path) 1207 else: # TODO(borenet): Remove this once we can get rid of the guard.
1191 exists = False 1208 if options.reset and options.delete_unversioned_trees:
1192 else: 1209 print 'Removing troublesome path %s' % self.checkout_path
1193 msg = ('Can\'t update/checkout %s if an unversioned directory is ' 1210 gclient_utils.rmtree(self.checkout_path)
1194 'present. Delete the directory and try again.') 1211 exists = False
1195 raise gclient_utils.Error(msg % self.checkout_path) 1212 else:
1213 msg = ('Can\'t update/checkout %s if an unversioned directory is '
1214 'present. Delete the directory and try again.')
1215 raise gclient_utils.Error(msg % self.checkout_path)
1216
1217 # Switch the checkout if necessary.
1218 if not needs_delete and from_info and from_info['URL'] != base_url:
1219 # The repository url changed, need to switch.
1220 try:
1221 to_info = scm.SVN.CaptureRemoteInfo(url)
1222 except (gclient_utils.Error, subprocess2.CalledProcessError):
1223 # The url is invalid or the server is not accessible, it's safer to bail
1224 # out right now.
1225 raise gclient_utils.Error('This url is unreachable: %s' % url)
1226 can_switch = ((from_info['Repository Root'] != to_info['Repository Root'])
1227 and (from_info['UUID'] == to_info['UUID']))
1228 if can_switch:
1229 print('\n_____ relocating %s to a new checkout' % self.relpath)
1230 # We have different roots, so check if we can switch --relocate.
1231 # Subversion only permits this if the repository UUIDs match.
1232 # Perform the switch --relocate, then rewrite the from_url
1233 # to reflect where we "are now." (This is the same way that
1234 # Subversion itself handles the metadata when switch --relocate
1235 # is used.) This makes the checks below for whether we
1236 # can update to a revision or have to switch to a different
1237 # branch work as expected.
1238 # TODO(maruel): TEST ME !
1239 command = ['switch', '--relocate',
1240 from_info['Repository Root'],
1241 to_info['Repository Root'],
1242 self.relpath]
1243 self._Run(command, options, cwd=self._root_dir)
1244 from_info['URL'] = from_info['URL'].replace(
1245 from_info['Repository Root'],
1246 to_info['Repository Root'])
1247 else:
1248 needs_delete = True
1249
1250 if (needs_delete and
1251 gclient_utils.enable_deletion_of_conflicting_checkouts()):
1252 if options.force:
1253 gclient_utils.rmtree(self.checkout_path)
1254 exists = False
1255 else:
1256 raise gclient_utils.Error('Conflicting directory found in %s. Please '
1257 'delete it or run with --force.'
1258 % self.checkout_path)
1196 1259
1197 BASE_URLS = { 1260 BASE_URLS = {
1198 '/chrome/trunk/src': 'gs://chromium-svn-checkout/chrome/', 1261 '/chrome/trunk/src': 'gs://chromium-svn-checkout/chrome/',
1199 '/blink/trunk': 'gs://chromium-svn-checkout/blink/', 1262 '/blink/trunk': 'gs://chromium-svn-checkout/blink/',
1200 } 1263 }
1201 WHITELISTED_ROOTS = [ 1264 WHITELISTED_ROOTS = [
1202 'svn://svn.chromium.org', 1265 'svn://svn.chromium.org',
1203 'svn://svn-mirror.golo.chromium.org', 1266 'svn://svn-mirror.golo.chromium.org',
1204 ] 1267 ]
1205 if not exists: 1268 if not exists:
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 print 'Resuming normal operations.' 1326 print 'Resuming normal operations.'
1264 print str(e) 1327 print str(e)
1265 1328
1266 gclient_utils.safe_makedirs(os.path.dirname(self.checkout_path)) 1329 gclient_utils.safe_makedirs(os.path.dirname(self.checkout_path))
1267 # We need to checkout. 1330 # We need to checkout.
1268 command = ['checkout', url, self.checkout_path] 1331 command = ['checkout', url, self.checkout_path]
1269 command = self._AddAdditionalUpdateFlags(command, options, revision) 1332 command = self._AddAdditionalUpdateFlags(command, options, revision)
1270 self._RunAndGetFileList(command, options, file_list, self._root_dir) 1333 self._RunAndGetFileList(command, options, file_list, self._root_dir)
1271 return self.Svnversion() 1334 return self.Svnversion()
1272 1335
1273 if not managed:
1274 print ('________ unmanaged solution; skipping %s' % self.relpath)
1275 return self.Svnversion()
1276
1277 if 'URL' not in from_info: 1336 if 'URL' not in from_info:
1278 raise gclient_utils.Error( 1337 raise gclient_utils.Error(
1279 ('gclient is confused. Couldn\'t get the url for %s.\n' 1338 ('gclient is confused. Couldn\'t get the url for %s.\n'
1280 'Try using @unmanaged.\n%s') % ( 1339 'Try using @unmanaged.\n%s') % (
1281 self.checkout_path, from_info)) 1340 self.checkout_path, from_info))
1282 1341
1283 # Look for locked directories. 1342 # Look for locked directories.
1284 dir_info = scm.SVN.CaptureStatus( 1343 dir_info = scm.SVN.CaptureStatus(
1285 None, os.path.join(self.checkout_path, '.')) 1344 None, os.path.join(self.checkout_path, '.'))
1286 if any(d[0][2] == 'L' for d in dir_info): 1345 if any(d[0][2] == 'L' for d in dir_info):
(...skipping 21 matching lines...) Expand all
1308 if d[0][0] == '!': 1367 if d[0][0] == '!':
1309 print 'You can pass --force to enable automatic removal.' 1368 print 'You can pass --force to enable automatic removal.'
1310 raise e 1369 raise e
1311 1370
1312 # Retrieve the current HEAD version because svn is slow at null updates. 1371 # Retrieve the current HEAD version because svn is slow at null updates.
1313 if options.manually_grab_svn_rev and not revision: 1372 if options.manually_grab_svn_rev and not revision:
1314 from_info_live = scm.SVN.CaptureRemoteInfo(from_info['URL']) 1373 from_info_live = scm.SVN.CaptureRemoteInfo(from_info['URL'])
1315 revision = str(from_info_live['Revision']) 1374 revision = str(from_info_live['Revision'])
1316 rev_str = ' at %s' % revision 1375 rev_str = ' at %s' % revision
1317 1376
1318 if from_info['URL'] != base_url:
1319 # The repository url changed, need to switch.
1320 try:
1321 to_info = scm.SVN.CaptureRemoteInfo(url)
1322 except (gclient_utils.Error, subprocess2.CalledProcessError):
1323 # The url is invalid or the server is not accessible, it's safer to bail
1324 # out right now.
1325 raise gclient_utils.Error('This url is unreachable: %s' % url)
1326 can_switch = ((from_info['Repository Root'] != to_info['Repository Root'])
1327 and (from_info['UUID'] == to_info['UUID']))
1328 if can_switch:
1329 print('\n_____ relocating %s to a new checkout' % self.relpath)
1330 # We have different roots, so check if we can switch --relocate.
1331 # Subversion only permits this if the repository UUIDs match.
1332 # Perform the switch --relocate, then rewrite the from_url
1333 # to reflect where we "are now." (This is the same way that
1334 # Subversion itself handles the metadata when switch --relocate
1335 # is used.) This makes the checks below for whether we
1336 # can update to a revision or have to switch to a different
1337 # branch work as expected.
1338 # TODO(maruel): TEST ME !
1339 command = ['switch', '--relocate',
1340 from_info['Repository Root'],
1341 to_info['Repository Root'],
1342 self.relpath]
1343 self._Run(command, options, cwd=self._root_dir)
1344 from_info['URL'] = from_info['URL'].replace(
1345 from_info['Repository Root'],
1346 to_info['Repository Root'])
1347 else:
1348 if not options.force and not options.reset:
1349 # Look for local modifications but ignore unversioned files.
1350 for status in scm.SVN.CaptureStatus(None, self.checkout_path):
1351 if status[0][0] != '?':
1352 raise gclient_utils.Error(
1353 ('Can\'t switch the checkout to %s; UUID don\'t match and '
1354 'there is local changes in %s. Delete the directory and '
1355 'try again.') % (url, self.checkout_path))
1356 # Ok delete it.
1357 print('\n_____ switching %s to a new checkout' % self.relpath)
1358 gclient_utils.rmtree(self.checkout_path)
1359 # We need to checkout.
1360 command = ['checkout', url, self.checkout_path]
1361 command = self._AddAdditionalUpdateFlags(command, options, revision)
1362 self._RunAndGetFileList(command, options, file_list, self._root_dir)
1363 return self.Svnversion()
1364
1365 # If the provided url has a revision number that matches the revision 1377 # If the provided url has a revision number that matches the revision
1366 # number of the existing directory, then we don't need to bother updating. 1378 # number of the existing directory, then we don't need to bother updating.
1367 if not options.force and str(from_info['Revision']) == revision: 1379 if not options.force and str(from_info['Revision']) == revision:
1368 if options.verbose or not forced_revision: 1380 if options.verbose or not forced_revision:
1369 print('\n_____ %s%s' % (self.relpath, rev_str)) 1381 print('\n_____ %s%s' % (self.relpath, rev_str))
1370 else: 1382 else:
1371 command = ['update', self.checkout_path] 1383 command = ['update', self.checkout_path]
1372 command = self._AddAdditionalUpdateFlags(command, options, revision) 1384 command = self._AddAdditionalUpdateFlags(command, options, revision)
1373 self._RunAndGetFileList(command, options, file_list, self._root_dir) 1385 self._RunAndGetFileList(command, options, file_list, self._root_dir)
1374 1386
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 # svn revert won't work if the directory doesn't exist. It needs to 1436 # svn revert won't work if the directory doesn't exist. It needs to
1425 # checkout instead. 1437 # checkout instead.
1426 print('\n_____ %s is missing, synching instead' % self.relpath) 1438 print('\n_____ %s is missing, synching instead' % self.relpath)
1427 # Don't reuse the args. 1439 # Don't reuse the args.
1428 return self.update(options, [], file_list) 1440 return self.update(options, [], file_list)
1429 1441
1430 if not os.path.isdir(os.path.join(self.checkout_path, '.svn')): 1442 if not os.path.isdir(os.path.join(self.checkout_path, '.svn')):
1431 if os.path.isdir(os.path.join(self.checkout_path, '.git')): 1443 if os.path.isdir(os.path.join(self.checkout_path, '.git')):
1432 print('________ found .git directory; skipping %s' % self.relpath) 1444 print('________ found .git directory; skipping %s' % self.relpath)
1433 return 1445 return
1434 if os.path.isdir(os.path.join(self.checkout_path, '.hg')):
1435 print('________ found .hg directory; skipping %s' % self.relpath)
1436 return
1437 if not options.force: 1446 if not options.force:
1438 raise gclient_utils.Error('Invalid checkout path, aborting') 1447 raise gclient_utils.Error('Invalid checkout path, aborting')
1439 print( 1448 print(
1440 '\n_____ %s is not a valid svn checkout, synching instead' % 1449 '\n_____ %s is not a valid svn checkout, synching instead' %
1441 self.relpath) 1450 self.relpath)
1442 gclient_utils.rmtree(self.checkout_path) 1451 gclient_utils.rmtree(self.checkout_path)
1443 # Don't reuse the args. 1452 # Don't reuse the args.
1444 return self.update(options, [], file_list) 1453 return self.update(options, [], file_list)
1445 1454
1446 def printcb(file_status): 1455 def printcb(file_status):
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 new_command.append('--force') 1553 new_command.append('--force')
1545 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1554 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1546 new_command.extend(('--accept', 'theirs-conflict')) 1555 new_command.extend(('--accept', 'theirs-conflict'))
1547 elif options.manually_grab_svn_rev: 1556 elif options.manually_grab_svn_rev:
1548 new_command.append('--force') 1557 new_command.append('--force')
1549 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1558 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1550 new_command.extend(('--accept', 'postpone')) 1559 new_command.extend(('--accept', 'postpone'))
1551 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1560 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1552 new_command.extend(('--accept', 'postpone')) 1561 new_command.extend(('--accept', 'postpone'))
1553 return new_command 1562 return new_command
OLDNEW
« no previous file with comments | « no previous file | gclient_utils.py » ('j') | scm.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698