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

Side by Side Diff: gclient_scm.py

Issue 245293003: Revert of Run `svn cleanup` before every update and reset. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 6 years, 8 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
« no previous file with comments | « no previous file | tests/gclient_scm_test.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 from __future__ import print_function 7 from __future__ import print_function
8 8
9 import logging 9 import logging
10 import os 10 import os
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 if os.path.exists(os.path.join(self.checkout_path, '.svn')): 1189 if os.path.exists(os.path.join(self.checkout_path, '.svn')):
1190 return self.Svnversion() 1190 return self.Svnversion()
1191 return 1191 return
1192 1192
1193 if 'URL' not in from_info: 1193 if 'URL' not in from_info:
1194 raise gclient_utils.Error( 1194 raise gclient_utils.Error(
1195 ('gclient is confused. Couldn\'t get the url for %s.\n' 1195 ('gclient is confused. Couldn\'t get the url for %s.\n'
1196 'Try using @unmanaged.\n%s') % ( 1196 'Try using @unmanaged.\n%s') % (
1197 self.checkout_path, from_info)) 1197 self.checkout_path, from_info))
1198 1198
1199 try: 1199 # Look for locked directories.
1200 self._Run(['cleanup', self.checkout_path], options) 1200 dir_info = scm.SVN.CaptureStatus(
1201 except subprocess2.CalledProcessError, e: 1201 None, os.path.join(self.checkout_path, '.'))
1202 # Look for locked directories. 1202 if any(d[0][2] == 'L' for d in dir_info):
1203 dir_info = scm.SVN.CaptureStatus( 1203 try:
1204 None, os.path.join(self.checkout_path, '.')) 1204 self._Run(['cleanup', self.checkout_path], options)
1205 if any(d[0][2] == 'L' for d in dir_info): 1205 except subprocess2.CalledProcessError, e:
1206 # Get the status again, svn cleanup may have cleaned up at least
1207 # something.
1208 dir_info = scm.SVN.CaptureStatus(
1209 None, os.path.join(self.checkout_path, '.'))
1210
1206 # Try to fix the failures by removing troublesome files. 1211 # Try to fix the failures by removing troublesome files.
1207 for d in dir_info: 1212 for d in dir_info:
1208 if d[0][2] == 'L': 1213 if d[0][2] == 'L':
1209 if d[0][0] == '!' and options.force: 1214 if d[0][0] == '!' and options.force:
1210 # We don't pass any files/directories to CaptureStatus and set 1215 # We don't pass any files/directories to CaptureStatus and set
1211 # cwd=self.checkout_path, so we should get relative paths here. 1216 # cwd=self.checkout_path, so we should get relative paths here.
1212 assert not os.path.isabs(d[1]) 1217 assert not os.path.isabs(d[1])
1213 path_to_remove = os.path.normpath( 1218 path_to_remove = os.path.normpath(
1214 os.path.join(self.checkout_path, d[1])) 1219 os.path.join(self.checkout_path, d[1]))
1215 self.Print('Removing troublesome path %s' % path_to_remove) 1220 self.Print('Removing troublesome path %s' % path_to_remove)
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 return 1353 return
1349 if not options.force: 1354 if not options.force:
1350 raise gclient_utils.Error('Invalid checkout path, aborting') 1355 raise gclient_utils.Error('Invalid checkout path, aborting')
1351 self.Print( 1356 self.Print(
1352 '\n_____ %s is not a valid svn checkout, synching instead' % 1357 '\n_____ %s is not a valid svn checkout, synching instead' %
1353 self.relpath) 1358 self.relpath)
1354 gclient_utils.rmtree(self.checkout_path) 1359 gclient_utils.rmtree(self.checkout_path)
1355 # Don't reuse the args. 1360 # Don't reuse the args.
1356 return self.update(options, [], file_list) 1361 return self.update(options, [], file_list)
1357 1362
1358 self._Run(['cleanup', self.checkout_path], options)
1359
1360 def printcb(file_status): 1363 def printcb(file_status):
1361 if file_list is not None: 1364 if file_list is not None:
1362 file_list.append(file_status[1]) 1365 file_list.append(file_status[1])
1363 if logging.getLogger().isEnabledFor(logging.INFO): 1366 if logging.getLogger().isEnabledFor(logging.INFO):
1364 logging.info('%s%s' % (file_status[0], file_status[1])) 1367 logging.info('%s%s' % (file_status[0], file_status[1]))
1365 else: 1368 else:
1366 self.Print(os.path.join(self.checkout_path, file_status[1])) 1369 self.Print(os.path.join(self.checkout_path, file_status[1]))
1367 scm.SVN.Revert(self.checkout_path, callback=printcb) 1370 scm.SVN.Revert(self.checkout_path, callback=printcb)
1368 1371
1369 # Revert() may delete the directory altogether. 1372 # Revert() may delete the directory altogether.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 new_command.append('--force') 1461 new_command.append('--force')
1459 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1462 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1460 new_command.extend(('--accept', 'theirs-conflict')) 1463 new_command.extend(('--accept', 'theirs-conflict'))
1461 elif options.manually_grab_svn_rev: 1464 elif options.manually_grab_svn_rev:
1462 new_command.append('--force') 1465 new_command.append('--force')
1463 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1466 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1464 new_command.extend(('--accept', 'postpone')) 1467 new_command.extend(('--accept', 'postpone'))
1465 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1468 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1466 new_command.extend(('--accept', 'postpone')) 1469 new_command.extend(('--accept', 'postpone'))
1467 return new_command 1470 return new_command
OLDNEW
« no previous file with comments | « no previous file | tests/gclient_scm_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698