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

Unified Diff: gclient_scm.py

Issue 208025: Fix gclient revert for external, switched and conflicted directories. (Closed)
Patch Set: Created 11 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gclient.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_scm.py
diff --git a/gclient_scm.py b/gclient_scm.py
index 148855c89ffc597d645314df55274da19909f303..b2895abddea08cc1da444b594242d84de21cc9e9 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -13,6 +13,7 @@
# limitations under the License.
+import logging
import os
import re
import subprocess
@@ -218,20 +219,25 @@ class SCMWrapper(object):
# Don't reuse the args.
return self.update(options, [], file_list)
- files = CaptureSVNStatus(path)
# Batch the command.
files_to_revert = []
- for file in files:
+ for file in CaptureSVNStatus(path):
file_path = os.path.join(path, file[1])
+ if file_path[0][0] == 'X':
+ # Ignore externals.
+ continue
+
print(file_path)
- # Unversioned file or unexpected unversioned file.
- if file[0][0] in ('?', '~'):
- # Remove extraneous file. Also remove unexpected unversioned
- # directories. svn won't touch them but we want to delete these.
- file_list.append(file_path)
+ # Unversioned file, unexpected unversioned files, switched directories
+ # or conflicted trees.
+ if file[0][0] in ('?', '~') or file[0][4] == 'S' or file[0][6] == 'C':
+ # Remove then since svn revert won't touch them.
try:
+ # TODO(maruel): Look if it is a file or a directory.
+ logging.info('os.remove(%s)' % file_path)
os.remove(file_path)
except EnvironmentError:
+ logging.info('gclient_utils.RemoveDirectory(%s)' % file_path)
gclient_utils.RemoveDirectory(file_path)
if file[0][0] != '?':
« no previous file with comments | « gclient.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698