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 """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 Loading... |
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 Loading... |
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 |
OLD | NEW |