From 6208757463803daa5809701227808a14154c5b35 Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Tue, 24 Apr 2012 23:16:28 +0000 Subject: [PATCH] Fix an error in gclient revert where a directory is unexpected and locked This would spurious try job failures because the gclient revert step would throw an exception. R=cmp@chromium.org BUG= TEST= Review URL: http://codereview.chromium.org/10169034 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@133799 0039d316-1c4b-4281-b951-d872f2087c98 --- scm.py | 5 +++++ tests/gclient_scm_test.py | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/scm.py b/scm.py index 2addcefefc..b1b0496f4f 100644 --- a/scm.py +++ b/scm.py @@ -1024,6 +1024,11 @@ class SVN(object): logging.info('Ignoring external %s' % file_status[1]) continue + # This is the case where '! L .' is returned by 'svn status'. Just + # strip off the '/.'. + if file_path.endswith(os.path.sep + '.'): + file_path = file_path[:-2] + if callback: callback(file_status) diff --git a/tests/gclient_scm_test.py b/tests/gclient_scm_test.py index ebe5e45dca..0d8e722d08 100755 --- a/tests/gclient_scm_test.py +++ b/tests/gclient_scm_test.py @@ -290,7 +290,8 @@ class SVNWrapperTestCase(BaseTestCase): ('~ ', '.'), ] gclient_scm.scm.SVN.CaptureStatus(None, self.base_path).AndReturn(items) - file_path = join(self.base_path, '.') + # RemoveDirectory() doesn't work on path ending with '.', like 'foo/.'. + file_path = self.base_path gclient_scm.os.path.exists(file_path).AndReturn(True) gclient_scm.os.path.isfile(file_path).AndReturn(False) gclient_scm.os.path.islink(file_path).AndReturn(False) @@ -305,7 +306,7 @@ class SVNWrapperTestCase(BaseTestCase): relpath=self.relpath) file_list2 = [] scm.revert(options, self.args, file_list2) - self.checkstdout(('%s\n' % file_path)) + self.checkstdout(('%s\n' % os.path.join(file_path, '.'))) def testStatus(self): options = self.Options(verbose=True)