Index: gclient_scm.py |
diff --git a/gclient_scm.py b/gclient_scm.py |
index ef93e5699aecf6f41fd6b56b56a593d4289e0ece..eb880c8959d5be039a5195a444e8015111028e94 100644 |
--- a/gclient_scm.py |
+++ b/gclient_scm.py |
@@ -929,7 +929,23 @@ class SVNWrapper(SCMWrapper): |
forced_revision = False |
rev_str = '' |
- if not os.path.exists(self.checkout_path): |
+ # Get the existing scm url and the revision number of the current checkout. |
+ exists = os.path.exists(self.checkout_path) |
+ if exists and managed: |
+ try: |
+ from_info = scm.SVN.CaptureLocalInfo( |
+ [], os.path.join(self.checkout_path, '.')) |
+ except (gclient_utils.Error, subprocess2.CalledProcessError): |
+ if options.reset and options.delete_unversioned_trees: |
+ print 'Removing troublesome path %s' % self.checkout_path |
+ gclient_utils.rmtree(self.checkout_path) |
Peter Mayo
2012/11/14 22:30:25
How does this report errors (e.g. owned by root su
M-A Ruel
2012/11/14 23:17:32
That will throw, IMHO it's not a big deal to not c
Peter Mayo
2012/11/15 01:37:10
It's not a big deal to me either, it's just a way
|
+ exists = False |
+ else: |
+ msg = ('Can\'t update/checkout %s if an unversioned directory is ' |
+ 'present. Delete the directory and try again.') |
+ raise gclient_utils.Error(msg % self.checkout_path) |
+ |
+ if not exists: |
gclient_utils.safe_makedirs(os.path.dirname(self.checkout_path)) |
# We need to checkout. |
command = ['checkout', url, self.checkout_path] |
@@ -941,15 +957,6 @@ class SVNWrapper(SCMWrapper): |
print ('________ unmanaged solution; skipping %s' % self.relpath) |
return |
- # Get the existing scm url and the revision number of the current checkout. |
- try: |
- from_info = scm.SVN.CaptureLocalInfo( |
- [], os.path.join(self.checkout_path, '.')) |
- except (gclient_utils.Error, subprocess2.CalledProcessError): |
- raise gclient_utils.Error( |
- ('Can\'t update/checkout %s if an unversioned directory is present. ' |
- 'Delete the directory and try again.') % self.checkout_path) |
- |
if 'URL' not in from_info: |
raise gclient_utils.Error( |
('gclient is confused. Couldn\'t get the url for %s.\n' |