Index: scm.py |
diff --git a/scm.py b/scm.py |
index 2690f1f9bb4fa3f83d3ef0bfc4c544668ec63064..471b9d7475e333fae4dcf1a4b608729fcb1d2d39 100644 |
--- a/scm.py |
+++ b/scm.py |
@@ -878,21 +878,26 @@ class SVN(object): |
# svn revert is really stupid. It fails on inconsistent line-endings, |
# on switched directories, etc. So take no chance and delete everything! |
- if file_status[0][0] == 'D': |
- # Deleted file requires manual intervention and require calling |
+ if file_status[0][0] in ('D', 'A') or file_status[0][2] != ' ': |
+ # Added, deleted file requires manual intervention and require calling |
# revert, like for properties. |
- gclient_utils.CheckCall( |
- ['svn', 'revert', file_status[1]], cwd=repo_root) |
+ try: |
+ SVN.Capture(['revert', file_status[1]], cwd=repo_root) |
+ except gclient_utils.CheckCallError: |
+ if not os.path.exists(file_path): |
+ continue |
+ raise |
+ |
+ if not os.path.exists(file_path): |
+ continue |
+ |
+ if os.path.isfile(file_path) or os.path.islink(file_path): |
+ logging.info('os.remove(%s)' % file_path) |
+ os.remove(file_path) |
+ elif os.path.isdir(file_path): |
+ logging.info('gclient_utils.RemoveDirectory(%s)' % file_path) |
+ gclient_utils.RemoveDirectory(file_path) |
else: |
- if not os.path.exists(file_path): |
- pass |
- elif os.path.isfile(file_path) or os.path.islink(file_path): |
- logging.info('os.remove(%s)' % file_path) |
- os.remove(file_path) |
- elif os.path.isdir(file_path): |
- logging.info('gclient_utils.RemoveDirectory(%s)' % file_path) |
- gclient_utils.RemoveDirectory(file_path) |
- else: |
- logging.critical( |
- ('No idea what is %s.\nYou just found a bug in gclient' |
- ', please ping maruel@chromium.org ASAP!') % file_path) |
+ logging.critical( |
+ ('No idea what is %s.\nYou just found a bug in gclient' |
+ ', please ping maruel@chromium.org ASAP!') % file_path) |