OLD | NEW |
1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2010 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 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 if callback: | 871 if callback: |
872 callback(file_status) | 872 callback(file_status) |
873 | 873 |
874 if file_status[0].isspace(): | 874 if file_status[0].isspace(): |
875 # Try reverting the file since it's probably a property change. | 875 # Try reverting the file since it's probably a property change. |
876 gclient_utils.CheckCall( | 876 gclient_utils.CheckCall( |
877 ['svn', 'revert', file_status[1]], cwd=repo_root) | 877 ['svn', 'revert', file_status[1]], cwd=repo_root) |
878 | 878 |
879 # svn revert is really stupid. It fails on inconsistent line-endings, | 879 # svn revert is really stupid. It fails on inconsistent line-endings, |
880 # on switched directories, etc. So take no chance and delete everything! | 880 # on switched directories, etc. So take no chance and delete everything! |
881 if file_status[0][0] in ('D', 'A') or file_status[0][2] != ' ': | 881 if file_status[0][0] in ('D', 'A', '!') or file_status[0][2] != ' ': |
882 # Added, deleted file requires manual intervention and require calling | 882 # Added, deleted file requires manual intervention and require calling |
883 # revert, like for properties. | 883 # revert, like for properties. |
884 try: | 884 try: |
885 SVN.Capture(['revert', file_status[1]], cwd=repo_root) | 885 SVN.Capture(['revert', file_status[1]], cwd=repo_root) |
886 except gclient_utils.CheckCallError: | 886 except gclient_utils.CheckCallError: |
887 if not os.path.exists(file_path): | 887 if not os.path.exists(file_path): |
888 continue | 888 continue |
889 raise | 889 raise |
890 | 890 |
891 if not os.path.exists(file_path): | 891 if not os.path.exists(file_path): |
892 continue | 892 continue |
893 | 893 |
894 if os.path.isfile(file_path) or os.path.islink(file_path): | 894 if os.path.isfile(file_path) or os.path.islink(file_path): |
895 logging.info('os.remove(%s)' % file_path) | 895 logging.info('os.remove(%s)' % file_path) |
896 os.remove(file_path) | 896 os.remove(file_path) |
897 elif os.path.isdir(file_path): | 897 elif os.path.isdir(file_path): |
898 logging.info('gclient_utils.RemoveDirectory(%s)' % file_path) | 898 logging.info('gclient_utils.RemoveDirectory(%s)' % file_path) |
899 gclient_utils.RemoveDirectory(file_path) | 899 gclient_utils.RemoveDirectory(file_path) |
900 else: | 900 else: |
901 logging.critical( | 901 logging.critical( |
902 ('No idea what is %s.\nYou just found a bug in gclient' | 902 ('No idea what is %s.\nYou just found a bug in gclient' |
903 ', please ping maruel@chromium.org ASAP!') % file_path) | 903 ', please ping maruel@chromium.org ASAP!') % file_path) |
OLD | NEW |