OLD | NEW |
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 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 except subprocess2.CalledProcessError, e: | 1223 except subprocess2.CalledProcessError, e: |
1224 # Get the status again, svn cleanup may have cleaned up at least | 1224 # Get the status again, svn cleanup may have cleaned up at least |
1225 # something. | 1225 # something. |
1226 dir_info = scm.SVN.CaptureStatus( | 1226 dir_info = scm.SVN.CaptureStatus( |
1227 None, os.path.join(self.checkout_path, '.')) | 1227 None, os.path.join(self.checkout_path, '.')) |
1228 | 1228 |
1229 # Try to fix the failures by removing troublesome files. | 1229 # Try to fix the failures by removing troublesome files. |
1230 for d in dir_info: | 1230 for d in dir_info: |
1231 if d[0][2] == 'L': | 1231 if d[0][2] == 'L': |
1232 if d[0][0] == '!' and options.force: | 1232 if d[0][0] == '!' and options.force: |
1233 print 'Removing troublesome path %s' % d[1] | 1233 # We don't pass any files/directories to CaptureStatus and set |
1234 gclient_utils.rmtree(d[1]) | 1234 # cwd=self.checkout_path, so we should get relative paths here. |
| 1235 assert not os.path.isabs(d[1]) |
| 1236 path_to_remove = os.path.normpath( |
| 1237 os.path.join(self.checkout_path, d[1])) |
| 1238 print 'Removing troublesome path %s' % path_to_remove |
| 1239 gclient_utils.rmtree(path_to_remove) |
1235 else: | 1240 else: |
1236 print 'Not removing troublesome path %s automatically.' % d[1] | 1241 print 'Not removing troublesome path %s automatically.' % d[1] |
1237 if d[0][0] == '!': | 1242 if d[0][0] == '!': |
1238 print 'You can pass --force to enable automatic removal.' | 1243 print 'You can pass --force to enable automatic removal.' |
1239 raise e | 1244 raise e |
1240 | 1245 |
1241 # Retrieve the current HEAD version because svn is slow at null updates. | 1246 # Retrieve the current HEAD version because svn is slow at null updates. |
1242 if options.manually_grab_svn_rev and not revision: | 1247 if options.manually_grab_svn_rev and not revision: |
1243 from_info_live = scm.SVN.CaptureRemoteInfo(from_info['URL']) | 1248 from_info_live = scm.SVN.CaptureRemoteInfo(from_info['URL']) |
1244 revision = str(from_info_live['Revision']) | 1249 revision = str(from_info_live['Revision']) |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1469 new_command.append('--force') | 1474 new_command.append('--force') |
1470 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1475 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1471 new_command.extend(('--accept', 'theirs-conflict')) | 1476 new_command.extend(('--accept', 'theirs-conflict')) |
1472 elif options.manually_grab_svn_rev: | 1477 elif options.manually_grab_svn_rev: |
1473 new_command.append('--force') | 1478 new_command.append('--force') |
1474 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1479 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1475 new_command.extend(('--accept', 'postpone')) | 1480 new_command.extend(('--accept', 'postpone')) |
1476 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1481 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1477 new_command.extend(('--accept', 'postpone')) | 1482 new_command.extend(('--accept', 'postpone')) |
1478 return new_command | 1483 return new_command |
OLD | NEW |