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