From ce117f619302f457c2d98de59303276a6e7c339a Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Mon, 17 Jan 2011 20:04:25 +0000 Subject: [PATCH] Add --ignore-externals to svn update and svn checkout invocations. svn:externals are slow to update and are unnecessary in a gclient environment. TEST=none BUG=55904 Review URL: http://codereview.chromium.org/3421013 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@71604 0039d316-1c4b-4281-b951-d872f2087c98 --- gclient_scm.py | 15 +++++--- tests/gclient_scm_test.py | 75 +++++++++++++++++++++++---------------- 2 files changed, 54 insertions(+), 36 deletions(-) diff --git a/gclient_scm.py b/gclient_scm.py index b5e8861736..0a1bbf12de 100644 --- a/gclient_scm.py +++ b/gclient_scm.py @@ -840,10 +840,12 @@ class SVNWrapper(SCMWrapper): for file_status in scm.SVN.CaptureStatus(self.checkout_path): file_path = os.path.join(self.checkout_path, file_status[1]) - if file_status[0][0] == 'X': - # Ignore externals. - logging.info('Ignoring external %s' % file_path) - continue + # Temporarily forcibly delete externals to make sure chromium can build + # without svn:external's. + #if file_status[0][0] == 'X': + # # Ignore externals. + # logging.info('Ignoring external %s' % file_path) + # continue if logging.getLogger().isEnabledFor(logging.INFO): logging.info('%s%s' % (file[0], file[1])) @@ -916,7 +918,10 @@ class SVNWrapper(SCMWrapper): def _RunAndGetFileList(self, args, options, file_list, cwd=None): """Runs a commands that goes to stdout and grabs the file listed.""" cwd = cwd or self.checkout_path - scm.SVN.RunAndGetFileList(options.verbose, args, cwd=cwd, + scm.SVN.RunAndGetFileList( + options.verbose, + args + ['--ignore-externals'], + cwd=cwd, file_list=file_list) @staticmethod diff --git a/tests/gclient_scm_test.py b/tests/gclient_scm_test.py index f86bdcba62..00ae0d8c66 100755 --- a/tests/gclient_scm_test.py +++ b/tests/gclient_scm_test.py @@ -138,11 +138,11 @@ class SVNWrapperTestCase(BaseTestCase): # Checkout. gclient_scm.os.path.exists(self.base_path).AndReturn(False) files_list = self.mox.CreateMockAnything() - gclient_scm.scm.SVN.RunAndGetFileList(options.verbose, - ['checkout', self.url, self.base_path, - '--force'], - cwd=self.root_dir, - file_list=files_list) + gclient_scm.scm.SVN.RunAndGetFileList( + options.verbose, + ['checkout', self.url, self.base_path, '--force', '--ignore-externals'], + cwd=self.root_dir, + file_list=files_list) self.mox.ReplayAll() scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, @@ -155,10 +155,11 @@ class SVNWrapperTestCase(BaseTestCase): options = self.Options(verbose=True) gclient_scm.os.path.isdir(self.base_path).AndReturn(True) gclient_scm.scm.SVN.CaptureStatus(self.base_path).AndReturn([]) - gclient_scm.scm.SVN.RunAndGetFileList(options.verbose, - ['update', '--revision', 'BASE'], - cwd=self.base_path, - file_list=mox.IgnoreArg()) + gclient_scm.scm.SVN.RunAndGetFileList( + options.verbose, + ['update', '--revision', 'BASE', '--ignore-externals'], + cwd=self.base_path, + file_list=mox.IgnoreArg()) self.mox.ReplayAll() scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, @@ -182,10 +183,11 @@ class SVNWrapperTestCase(BaseTestCase): gclient_scm.os.path.exists(file_path2).AndReturn(True) gclient_scm.os.path.isfile(file_path2).AndReturn(True) gclient_scm.os.remove(file_path2) - gclient_scm.scm.SVN.RunAndGetFileList(options.verbose, - ['update', '--revision', 'BASE'], - cwd=self.base_path, - file_list=mox.IgnoreArg()) + gclient_scm.scm.SVN.RunAndGetFileList( + options.verbose, + ['update', '--revision', 'BASE', '--ignore-externals'], + cwd=self.base_path, + file_list=mox.IgnoreArg()) self.mox.ReplayAll() scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, @@ -209,10 +211,11 @@ class SVNWrapperTestCase(BaseTestCase): gclient_scm.os.path.islink(file_path).AndReturn(False) gclient_scm.os.path.isdir(file_path).AndReturn(True) gclient_scm.gclient_utils.RemoveDirectory(file_path) - gclient_scm.scm.SVN.RunAndGetFileList(options.verbose, - ['update', '--revision', 'BASE'], - cwd=self.base_path, - file_list=mox.IgnoreArg()) + gclient_scm.scm.SVN.RunAndGetFileList( + options.verbose, + ['update', '--revision', 'BASE', '--ignore-externals'], + cwd=self.base_path, + file_list=mox.IgnoreArg()) self.mox.ReplayAll() scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, @@ -225,8 +228,10 @@ class SVNWrapperTestCase(BaseTestCase): options = self.Options(verbose=True) gclient_scm.os.path.isdir(self.base_path).AndReturn(True) gclient_scm.scm.SVN.RunAndGetFileList( - options.verbose, ['status'] + self.args, - cwd=self.base_path, file_list=[]).AndReturn(None) + options.verbose, + ['status'] + self.args + ['--ignore-externals'], + cwd=self.base_path, + file_list=[]).AndReturn(None) self.mox.ReplayAll() scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, @@ -250,11 +255,11 @@ class SVNWrapperTestCase(BaseTestCase): files_list = self.mox.CreateMockAnything() gclient_scm.scm.SVN.Capture(['--version'] ).AndReturn('svn, version 1.5.1 (r32289)') - gclient_scm.scm.SVN.RunAndGetFileList(options.verbose, - ['checkout', self.url, self.base_path, - '--force'], - cwd=self.root_dir, - file_list=files_list) + gclient_scm.scm.SVN.RunAndGetFileList( + options.verbose, + ['checkout', self.url, self.base_path, '--force', '--ignore-externals'], + cwd=self.root_dir, + file_list=files_list) self.mox.ReplayAll() scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, relpath=self.relpath) @@ -287,7 +292,7 @@ class SVNWrapperTestCase(BaseTestCase): additional_args = ['--revision', str(file_info['Revision'])] gclient_scm.scm.SVN.Capture(['--version'] ).AndReturn('svn, version 1.5.1 (r32289)') - additional_args.append('--force') + additional_args.extend(['--force', '--ignore-externals']) files_list = [] gclient_scm.scm.SVN.RunAndGetFileList( options.verbose, @@ -321,9 +326,13 @@ class SVNWrapperTestCase(BaseTestCase): files_list = self.mox.CreateMockAnything() gclient_scm.gclient_utils.CheckCallAndFilterAndHeader( ['svn', 'checkout', '--depth', 'empty', self.url, self.base_path], - always=True, cwd=self.root_dir) - gclient_scm.scm.SVN.RunAndGetFileList(options.verbose, ['update', 'DEPS'], - cwd=self.base_path, file_list=files_list) + always=True, + cwd=self.root_dir) + gclient_scm.scm.SVN.RunAndGetFileList( + options.verbose, + ['update', 'DEPS', '--ignore-externals'], + cwd=self.base_path, + file_list=files_list) # Now we fall back on scm.update(). gclient_scm.os.path.exists(join(self.base_path, '.git')).AndReturn(False) @@ -382,9 +391,13 @@ class SVNWrapperTestCase(BaseTestCase): files_list = self.mox.CreateMockAnything() gclient_scm.gclient_utils.CheckCallAndFilterAndHeader( ['svn', 'checkout', '--depth', 'empty', self.url, self.base_path], - always=True, cwd=self.root_dir) - gclient_scm.scm.SVN.RunAndGetFileList(options.verbose, ['update', 'DEPS'], - cwd=self.base_path, file_list=files_list) + always=True, + cwd=self.root_dir) + gclient_scm.scm.SVN.RunAndGetFileList( + options.verbose, + ['update', 'DEPS', '--ignore-externals'], + cwd=self.base_path, + file_list=files_list) # Now we fall back on scm.update(). gclient_scm.os.path.exists(join(self.base_path, '.git')).AndReturn(False)