Commit f547c80c authored by scottmg@chromium.org's avatar scottmg@chromium.org

Delete nag_max and nag_timer

It's impossible to sync by default on Windows and has been since this was
added: https://www.google.com/search?q=chromium-dev+nag_max

Most recently: https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/CEpATyu9udc

So, remove it. If someone needs it they can figure out a more targeted
implementation.

Keep --no-nag-max for backwards compat so that bot scripts won't fail out.
I'll remove it from bot scripts after this has baked a while, and then
come back and remove the option.

R=iannucci@chromium.org

Review URL: https://chromiumcodereview.appspot.com/24950002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@225730 0039d316-1c4b-4281-b951-d872f2087c98
parent 16d2ad68
......@@ -1768,8 +1768,7 @@ class OptionParser(optparse.OptionParser):
'Cygwin/Python brokenness, it can\'t contain any newlines.')
self.add_option(
'--no-nag-max', default=False, action='store_true',
help='If a subprocess runs for too long without generating terminal '
'output, generate warnings, but do not kill the process.')
help='Ignored for backwards compatibility.')
def parse_args(self, args=None, values=None):
"""Integrates standard options processing."""
......@@ -1800,8 +1799,6 @@ class OptionParser(optparse.OptionParser):
options.manually_grab_svn_rev = None
if not hasattr(options, 'force'):
options.force = None
if options.no_nag_max:
gclient_scm.SCMWrapper.nag_max = None
return (options, args)
......
......@@ -123,9 +123,6 @@ class SCMWrapper(object):
This is the abstraction layer to bind to different SCM.
"""
nag_timer = 30
nag_max = 30
def __init__(self, url=None, root_dir=None, relpath=None):
self.url = url
self._root_dir = root_dir
......@@ -247,8 +244,6 @@ class GitWrapper(SCMWrapper):
gclient_utils.CheckCallAndFilter(
['git', 'diff', merge_base],
cwd=self.checkout_path,
nag_timer=self.nag_timer,
nag_max=self.nag_max,
filter_fn=GitDiffFilterer(self.relpath).Filter)
def UpdateSubmoduleConfig(self):
......@@ -262,8 +257,6 @@ class GitWrapper(SCMWrapper):
cmd4 = ['git', 'config', 'fetch.recurseSubmodules', 'false']
kwargs = {'cwd': self.checkout_path,
'print_stdout': False,
'nag_timer': self.nag_timer,
'nag_max': self.nag_max,
'filter_fn': lambda x: None}
try:
gclient_utils.CheckCallAndFilter(cmd, **kwargs)
......@@ -1036,8 +1029,6 @@ class GitWrapper(SCMWrapper):
return subprocess2.check_output(
['git'] + args,
stderr=subprocess2.VOID,
nag_timer=self.nag_timer,
nag_max=self.nag_max,
cwd=cwd or self.checkout_path).strip()
def _UpdateBranchHeads(self, options, fetch=False):
......@@ -1064,11 +1055,8 @@ class GitWrapper(SCMWrapper):
def _Run(self, args, _options, git_filter=False, **kwargs):
kwargs.setdefault('cwd', self.checkout_path)
kwargs.setdefault('nag_timer', self.nag_timer)
kwargs.setdefault('nag_max', self.nag_max)
if git_filter:
kwargs['filter_fn'] = GitFilter(kwargs['nag_timer'] / 2,
kwargs.get('filter_fn'))
kwargs['filter_fn'] = GitFilter(kwargs.get('filter_fn'))
kwargs.setdefault('print_stdout', False)
# Don't prompt for passwords; just fail quickly and noisily.
# By default, git will use an interactive terminal prompt when a username/
......@@ -1136,8 +1124,6 @@ class SVNWrapper(SCMWrapper):
['svn', 'diff', '-x', '--ignore-eol-style'] + args,
cwd=self.checkout_path,
print_stdout=False,
nag_timer=self.nag_timer,
nag_max=self.nag_max,
filter_fn=SvnDiffFilterer(self.relpath).Filter)
def update(self, options, args, file_list):
......@@ -1442,8 +1428,6 @@ class SVNWrapper(SCMWrapper):
def _Run(self, args, options, **kwargs):
"""Runs a commands that goes to stdout."""
kwargs.setdefault('cwd', self.checkout_path)
kwargs.setdefault('nag_timer', self.nag_timer)
kwargs.setdefault('nag_max', self.nag_max)
gclient_utils.CheckCallAndFilterAndHeader(['svn'] + args,
always=options.verbose, **kwargs)
......
......@@ -407,7 +407,7 @@ class GClientChildren(object):
def CheckCallAndFilter(args, stdout=None, filter_fn=None,
print_stdout=None, call_filter_on_first_line=False,
nag_timer=None, nag_max=None, **kwargs):
**kwargs):
"""Runs a command and calls back a filter function if needed.
Accepts all subprocess2.Popen() parameters plus:
......@@ -431,21 +431,6 @@ def CheckCallAndFilter(args, stdout=None, filter_fn=None,
# Do a flush of stdout before we begin reading from the subprocess2's stdout
stdout.flush()
nag = None
if nag_timer:
# Hack thread.index to force correct annotation.
index = getattr(threading.currentThread(), 'index', 0)
def _nag_cb(elapsed):
setattr(threading.currentThread(), 'index', index)
stdout.write(' No output for %.0f seconds from command:\n' % elapsed)
stdout.write(' %s\n' % kid.cmd_str)
if (nag_max and
int('%.0f' % (elapsed / nag_timer)) >= nag_max):
stdout.write(' ... killing it!\n')
kid.kill()
nag = subprocess2.NagTimer(nag_timer, _nag_cb)
nag.start()
# Also, we need to forward stdout to prevent weird re-ordering of output.
# This has to be done on a per byte basis to make sure it is not buffered:
# normally buffering is done for each line, but if svn requests input, no
......@@ -453,8 +438,6 @@ def CheckCallAndFilter(args, stdout=None, filter_fn=None,
try:
in_byte = kid.stdout.read(1)
if in_byte:
if nag:
nag.event()
if call_filter_on_first_line:
filter_fn(None)
in_line = ''
......@@ -471,8 +454,6 @@ def CheckCallAndFilter(args, stdout=None, filter_fn=None,
filter_fn(in_line)
in_line = ''
in_byte = kid.stdout.read(1)
if in_byte and nag:
nag.event()
# Flush the rest of buffered output. This is only an issue with
# stdout/stderr not ending with a \n.
if len(in_line):
......@@ -486,9 +467,6 @@ def CheckCallAndFilter(args, stdout=None, filter_fn=None,
except KeyboardInterrupt:
print >> sys.stderr, 'Failed while running "%s"' % ' '.join(args)
raise
finally:
if nag:
nag.cancel()
if rv:
raise subprocess2.CalledProcessError(
......
......@@ -109,8 +109,6 @@ class SVNWrapperTestCase(BaseTestCase):
'cleanup',
'diff',
'name',
'nag_max',
'nag_timer',
'pack',
'relpath',
'revert',
......@@ -516,8 +514,6 @@ class SVNWrapperTestCase(BaseTestCase):
gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(
['svn', 'checkout', '--depth', 'empty', self.url, self.base_path],
always=True,
nag_max=30,
nag_timer=30,
cwd=self.root_dir)
gclient_scm.scm.SVN.RunAndGetFileList(
options.verbose,
......@@ -555,7 +551,7 @@ class SVNWrapperTestCase(BaseTestCase):
files_list = self.mox.CreateMockAnything()
gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(
['svn', 'export', join(self.url, 'DEPS'), join(self.base_path, 'DEPS')],
nag_timer=30, nag_max=30, always=True, cwd=self.root_dir)
always=True, cwd=self.root_dir)
self.mox.ReplayAll()
scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
......@@ -588,8 +584,6 @@ class SVNWrapperTestCase(BaseTestCase):
gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(
['svn', 'checkout', '--depth', 'empty', self.url, self.base_path],
always=True,
nag_max=30,
nag_timer=30,
cwd=self.root_dir)
gclient_scm.scm.SVN.RunAndGetFileList(
options.verbose,
......@@ -827,8 +821,6 @@ class ManagedGitWrapperTestCase(BaseGitWrapperTestCase):
'cleanup',
'diff',
'name',
'nag_max',
'nag_timer',
'pack',
'UpdateSubmoduleConfig',
'relpath',
......
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