Commit 77e4ecaf authored by maruel@chromium.org's avatar maruel@chromium.org

Remove cruft from having to do bookeeping of options.stdout.

This makes the code saner to understand.

TEST=none
BUG=none

Review URL: http://codereview.chromium.org/3420014

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@60050 0039d316-1c4b-4281-b951-d872f2087c98
parent 35db5099
......@@ -1203,8 +1203,6 @@ def Main(argv):
options.entries_filename = options.config_filename + '_entries'
if options.jobs < 1:
parser.error('--jobs must be 1 or higher')
# TODO(maruel): Temporary, to be removed.
options.stdout = sys.stdout
# These hacks need to die.
if not hasattr(options, 'revisions'):
......
This diff is collapsed.
......@@ -549,8 +549,8 @@ class WorkItem(object):
# A unique string representing this work item.
name = None
def run(self, work_queue, options):
"""work_queue and options are passed as keyword arguments so they should be
def run(self, work_queue):
"""work_queue is passed as keyword argument so it should be
the last parameters of the function when you override it."""
pass
......@@ -661,7 +661,7 @@ class ExecutionQueue(object):
self.running.append(t)
else:
t.join()
t.kwargs['options'].stdout.full_flush()
sys.stdout.full_flush()
if self.progress:
self.progress.update(1)
assert not t.item.name in self.ran
......@@ -672,10 +672,7 @@ class ExecutionQueue(object):
if self.jobs > 1:
# Start the thread.
index = len(self.ran) + len(self.running) + 1
# Copy 'options'.
task_kwargs = kwargs.copy()
task_kwargs['options'] = copy.copy(task_kwargs['options'])
new_thread = self._Worker(task_item, index, args, task_kwargs)
new_thread = self._Worker(task_item, index, args, kwargs)
self.running.append(new_thread)
new_thread.start()
else:
......
......@@ -64,7 +64,6 @@ class SVNWrapperTestCase(BaseTestCase):
self.force = False
self.reset = False
self.nohooks = False
self.stdout = gclient_scm.sys.stdout
def Options(self, *args, **kwargs):
return self.OptionsObject(*args, **kwargs)
......@@ -137,8 +136,7 @@ class SVNWrapperTestCase(BaseTestCase):
['checkout', self.url, base_path,
'--force'],
cwd=self.root_dir,
file_list=files_list,
stdout=options.stdout)
file_list=files_list)
self.mox.ReplayAll()
scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
......@@ -155,8 +153,7 @@ class SVNWrapperTestCase(BaseTestCase):
gclient_scm.scm.SVN.RunAndGetFileList(options.verbose,
['update', '--revision', 'BASE'],
cwd=base_path,
file_list=mox.IgnoreArg(),
stdout=options.stdout)
file_list=mox.IgnoreArg())
self.mox.ReplayAll()
scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
......@@ -184,8 +181,7 @@ class SVNWrapperTestCase(BaseTestCase):
gclient_scm.scm.SVN.RunAndGetFileList(options.verbose,
['update', '--revision', 'BASE'],
cwd=base_path,
file_list=mox.IgnoreArg(),
stdout=options.stdout)
file_list=mox.IgnoreArg())
self.mox.ReplayAll()
scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
......@@ -214,8 +210,7 @@ class SVNWrapperTestCase(BaseTestCase):
gclient_scm.scm.SVN.RunAndGetFileList(options.verbose,
['update', '--revision', 'BASE'],
cwd=base_path,
file_list=mox.IgnoreArg(),
stdout=options.stdout)
file_list=mox.IgnoreArg())
self.mox.ReplayAll()
scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
......@@ -228,10 +223,9 @@ class SVNWrapperTestCase(BaseTestCase):
options = self.Options(verbose=True)
base_path = gclient_scm.os.path.join(self.root_dir, self.relpath)
gclient_scm.os.path.isdir(base_path).AndReturn(True)
gclient_scm.scm.SVN.RunAndGetFileList(options.verbose,
['status'] + self.args,
cwd=base_path, file_list=[],
stdout=options.stdout).AndReturn(None)
gclient_scm.scm.SVN.RunAndGetFileList(
options.verbose, ['status'] + self.args,
cwd=base_path, file_list=[]).AndReturn(None)
self.mox.ReplayAll()
scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
......@@ -260,8 +254,7 @@ class SVNWrapperTestCase(BaseTestCase):
['checkout', self.url, base_path,
'--force'],
cwd=self.root_dir,
file_list=files_list,
stdout=options.stdout)
file_list=files_list)
self.mox.ReplayAll()
scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
relpath=self.relpath)
......@@ -301,7 +294,7 @@ class SVNWrapperTestCase(BaseTestCase):
gclient_scm.scm.SVN.RunAndGetFileList(
options.verbose,
['update', base_path] + additional_args,
cwd=self.root_dir, file_list=files_list, stdout=options.stdout)
cwd=self.root_dir, file_list=files_list)
self.mox.ReplayAll()
scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
......@@ -333,9 +326,9 @@ class SVNWrapperTestCase(BaseTestCase):
files_list = self.mox.CreateMockAnything()
gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(
['svn', 'checkout', '--depth', 'empty', self.url, base_path],
always=True, cwd=self.root_dir, stdout=options.stdout)
always=True, cwd=self.root_dir)
gclient_scm.scm.SVN.RunAndGetFileList(options.verbose, ['update', 'DEPS'],
cwd=base_path, file_list=files_list, stdout=options.stdout)
cwd=base_path, file_list=files_list)
# Now we fall back on scm.update().
gclient_scm.os.path.exists(gclient_scm.os.path.join(base_path, '.git')
......@@ -371,7 +364,7 @@ class SVNWrapperTestCase(BaseTestCase):
gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(
['svn', 'export', gclient_scm.os.path.join(self.url, 'DEPS'),
gclient_scm.os.path.join(base_path, 'DEPS')],
always=True, cwd=self.root_dir, stdout=options.stdout)
always=True, cwd=self.root_dir)
self.mox.ReplayAll()
scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
......@@ -406,9 +399,9 @@ class SVNWrapperTestCase(BaseTestCase):
files_list = self.mox.CreateMockAnything()
gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(
['svn', 'checkout', '--depth', 'empty', self.url, base_path],
always=True, cwd=self.root_dir, stdout=options.stdout)
always=True, cwd=self.root_dir)
gclient_scm.scm.SVN.RunAndGetFileList(options.verbose, ['update', 'DEPS'],
cwd=base_path, file_list=files_list, stdout=options.stdout)
cwd=base_path, file_list=files_list)
# Now we fall back on scm.update().
gclient_scm.os.path.exists(gclient_scm.os.path.join(base_path, '.git')
......@@ -484,7 +477,6 @@ class GitWrapperTestCase(GCBaseTestCase, StdoutCheck, TestCaseUtils,
self.force = False
self.reset = False
self.nohooks = False
self.stdout = gclient_scm.sys.stdout
sample_git_import = """blob
mark :1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment