Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: gclient_scm.py

Issue 14826003: Refactor nag functionality in to NagTimer class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Fix nag_max Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gclient_utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_scm.py
diff --git a/gclient_scm.py b/gclient_scm.py
index 26845b828059ace39915bf412f284663faa2a52f..9ccc76f217059810e41f3fd66e30affd7ff4727e 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -116,6 +116,9 @@ class SCMWrapper(object):
This is the abstraction layer to bind to different SCM.
"""
+ nag_timer = 30
+ nag_max = 3
+
def __init__(self, url=None, root_dir=None, relpath=None):
self.url = url
self._root_dir = root_dir
@@ -195,6 +198,8 @@ 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):
@@ -208,6 +213,8 @@ 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)
@@ -852,6 +859,8 @@ class GitWrapper(SCMWrapper):
return subprocess2.check_output(
['git'] + args,
stderr=subprocess2.PIPE,
+ nag_timer=self.nag_timer,
+ nag_max=self.nag_max,
cwd=self.checkout_path).strip()
def _UpdateBranchHeads(self, options, fetch=False):
@@ -879,6 +888,8 @@ class GitWrapper(SCMWrapper):
def _Run(self, args, options, **kwargs):
kwargs.setdefault('cwd', self.checkout_path)
kwargs.setdefault('print_stdout', True)
+ kwargs.setdefault('nag_timer', self.nag_timer)
+ kwargs.setdefault('nag_max', self.nag_max)
stdout = kwargs.get('stdout', sys.stdout)
stdout.write('\n________ running \'git %s\' in \'%s\'\n' % (
' '.join(args), kwargs['cwd']))
@@ -928,6 +939,8 @@ 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):
@@ -1225,6 +1238,8 @@ 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)
« no previous file with comments | « no previous file | gclient_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698