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

Side by Side Diff: scm.py

Issue 10169034: Fix an error in gclient revert where a directory is unexpected and locked (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 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 | Annotate | Revision Log
« 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 """SCM-specific utility classes.""" 5 """SCM-specific utility classes."""
6 6
7 import cStringIO 7 import cStringIO
8 import glob 8 import glob
9 import logging 9 import logging
10 import os 10 import os
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 """ 1017 """
1018 for file_status in SVN.CaptureStatus(None, cwd): 1018 for file_status in SVN.CaptureStatus(None, cwd):
1019 file_path = os.path.join(cwd, file_status[1]) 1019 file_path = os.path.join(cwd, file_status[1])
1020 if (ignore_externals and 1020 if (ignore_externals and
1021 file_status[0][0] == 'X' and 1021 file_status[0][0] == 'X' and
1022 file_status[0][1:].isspace()): 1022 file_status[0][1:].isspace()):
1023 # Ignore externals. 1023 # Ignore externals.
1024 logging.info('Ignoring external %s' % file_status[1]) 1024 logging.info('Ignoring external %s' % file_status[1])
1025 continue 1025 continue
1026 1026
1027 # This is the case where '! L .' is returned by 'svn status'. Just
1028 # strip off the '/.'.
1029 if file_path.endswith(os.path.sep + '.'):
1030 file_path = file_path[:-2]
1031
1027 if callback: 1032 if callback:
1028 callback(file_status) 1033 callback(file_status)
1029 1034
1030 if os.path.exists(file_path): 1035 if os.path.exists(file_path):
1031 # svn revert is really stupid. It fails on inconsistent line-endings, 1036 # svn revert is really stupid. It fails on inconsistent line-endings,
1032 # on switched directories, etc. So take no chance and delete everything! 1037 # on switched directories, etc. So take no chance and delete everything!
1033 # In theory, it wouldn't be necessary for property-only change but then 1038 # In theory, it wouldn't be necessary for property-only change but then
1034 # it'd have to look for switched directories, etc so it's not worth 1039 # it'd have to look for switched directories, etc so it's not worth
1035 # optimizing this use case. 1040 # optimizing this use case.
1036 if os.path.isfile(file_path) or os.path.islink(file_path): 1041 if os.path.isfile(file_path) or os.path.islink(file_path):
(...skipping 13 matching lines...) Expand all
1050 # revert, like for properties. 1055 # revert, like for properties.
1051 if not os.path.isdir(cwd): 1056 if not os.path.isdir(cwd):
1052 # '.' was deleted. It's not worth continuing. 1057 # '.' was deleted. It's not worth continuing.
1053 return 1058 return
1054 try: 1059 try:
1055 SVN.Capture(['revert', file_status[1]], cwd=cwd) 1060 SVN.Capture(['revert', file_status[1]], cwd=cwd)
1056 except subprocess2.CalledProcessError: 1061 except subprocess2.CalledProcessError:
1057 if not os.path.exists(file_path): 1062 if not os.path.exists(file_path):
1058 continue 1063 continue
1059 raise 1064 raise
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