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

Side by Side Diff: scm.py

Issue 6613025: Improve SVN.Revert() to catch more corner cases. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 9 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) 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
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] == 'D': 881 if file_status[0][0] in ('D', 'A') or file_status[0][2] != ' ':
882 # 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 gclient_utils.CheckCall( 884 try:
885 ['svn', 'revert', file_status[1]], cwd=repo_root) 885 SVN.Capture(['revert', file_status[1]], cwd=repo_root)
886 except gclient_utils.CheckCallError:
887 if not os.path.exists(file_path):
888 continue
889 raise
890
891 if not os.path.exists(file_path):
892 continue
893
894 if os.path.isfile(file_path) or os.path.islink(file_path):
895 logging.info('os.remove(%s)' % file_path)
896 os.remove(file_path)
897 elif os.path.isdir(file_path):
898 logging.info('gclient_utils.RemoveDirectory(%s)' % file_path)
899 gclient_utils.RemoveDirectory(file_path)
886 else: 900 else:
887 if not os.path.exists(file_path): 901 logging.critical(
888 pass 902 ('No idea what is %s.\nYou just found a bug in gclient'
889 elif os.path.isfile(file_path) or os.path.islink(file_path): 903 ', please ping maruel@chromium.org ASAP!') % file_path)
890 logging.info('os.remove(%s)' % file_path)
891 os.remove(file_path)
892 elif os.path.isdir(file_path):
893 logging.info('gclient_utils.RemoveDirectory(%s)' % file_path)
894 gclient_utils.RemoveDirectory(file_path)
895 else:
896 logging.critical(
897 ('No idea what is %s.\nYou just found a bug in gclient'
898 ', please ping maruel@chromium.org ASAP!') % file_path)
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