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

Unified Diff: gclient_scm.py

Issue 8227033: Make revert more resilient to partial sync failure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 2 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 | « no previous file | tests/gclient_scm_test.py » ('j') | 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 95890a450ce8eb5e79bcd110001508ecec51eac7..d2e77574912e5fc68fb5bfa6800a9ba6b4c400a5 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -920,12 +920,30 @@ class SVNWrapper(SCMWrapper):
doesn't know about them.
"""
if not os.path.isdir(self.checkout_path):
+ if os.path.exists(self.checkout_path):
+ gclient_utils.rmtree(self.checkout_path)
# svn revert won't work if the directory doesn't exist. It needs to
# checkout instead.
print('\n_____ %s is missing, synching instead' % self.relpath)
# Don't reuse the args.
return self.update(options, [], file_list)
+ if not os.path.isdir(os.path.join(self.checkout_path, '.svn')):
+ if os.path.isdir(os.path.join(self.checkout_path, '.git')):
+ print('________ found .git directory; skipping %s' % self.relpath)
+ return
+ if os.path.isdir(os.path.join(self.checkout_path, '.hg')):
+ print('________ found .hg directory; skipping %s' % self.relpath)
+ return
+ if not options.force:
+ raise gclient_utils.Error('Invalid checkout path, aborting')
+ print(
+ '\n_____ %s is not a valid svn checkout, synching instead' %
+ self.relpath)
+ gclient_utils.rmtree(self.checkout_path)
+ # Don't reuse the args.
+ return self.update(options, [], file_list)
+
def printcb(file_status):
file_list.append(file_status[1])
if logging.getLogger().isEnabledFor(logging.INFO):
« 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