From 6e904b4761107afc4ce5aee1ca599724cbba0bc9 Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Wed, 19 Dec 2012 14:21:14 +0000 Subject: [PATCH] Add workaround where SVN.Revert() deletes the checkout. This would cause a few exceptions on the CQ until it realizes the checkout is not present anymore. R=petermayo@chromium.org BUG= Review URL: https://chromiumcodereview.appspot.com/11649011 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@173916 0039d316-1c4b-4281-b951-d872f2087c98 --- checkout.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/checkout.py b/checkout.py index a303b338a..e2e7e3ab9 100644 --- a/checkout.py +++ b/checkout.py @@ -479,15 +479,18 @@ class SvnCheckout(CheckoutBase, SvnMixIn): flags = ['--ignore-externals'] if revision: flags.extend(['--revision', str(revision)]) - if not os.path.isdir(self.project_path): + if os.path.isdir(self.project_path): + # This may remove any part (or all) of the checkout. + scm.SVN.Revert(self.project_path, no_ignore=True) + + if os.path.isdir(self.project_path): + # Revive files that were deleted in scm.SVN.Revert(). + self._check_call_svn(['update', '--force'] + flags) + else: logging.info( 'Directory %s is not present, checking it out.' % self.project_path) self._check_call_svn( ['checkout', self.svn_url, self.project_path] + flags, cwd=None) - else: - scm.SVN.Revert(self.project_path, no_ignore=True) - # Revive files that were deleted in scm.SVN.Revert(). - self._check_call_svn(['update', '--force'] + flags) return self._get_revision() def _get_revision(self):