| Index: gclient_scm.py
|
| diff --git a/gclient_scm.py b/gclient_scm.py
|
| index 2a15abe5f810357d94dc68b58f5df181ff9576eb..dc2fc87c3966b99e783c7623ece4e631b1ecadaf 100644
|
| --- a/gclient_scm.py
|
| +++ b/gclient_scm.py
|
| @@ -12,7 +12,6 @@ import re
|
| import sys
|
| import tempfile
|
| import threading
|
| -import time
|
| import urlparse
|
|
|
| import download_from_google_storage
|
| @@ -142,43 +141,6 @@ class SCMWrapper(object):
|
| return getattr(self, command)(options, args, file_list)
|
|
|
|
|
| -class GitFilter(object):
|
| - """A filter_fn implementation for quieting down git output messages.
|
| -
|
| - Allows a custom function to skip certain lines (predicate), and will throttle
|
| - the output of percentage completed lines to only output every X seconds.
|
| - """
|
| - PERCENT_RE = re.compile('.* ([0-9]{1,2})% .*')
|
| -
|
| - def __init__(self, time_throttle=0, predicate=None):
|
| - """
|
| - Args:
|
| - time_throttle (int): GitFilter will throttle 'noisy' output (such as the
|
| - XX% complete messages) to only be printed at least |time_throttle|
|
| - seconds apart.
|
| - predicate (f(line)): An optional function which is invoked for every line.
|
| - The line will be skipped if predicate(line) returns False.
|
| - """
|
| - self.last_time = 0
|
| - self.time_throttle = time_throttle
|
| - self.predicate = predicate
|
| -
|
| - def __call__(self, line):
|
| - # git uses an escape sequence to clear the line; elide it.
|
| - esc = line.find(unichr(033))
|
| - if esc > -1:
|
| - line = line[:esc]
|
| - if self.predicate and not self.predicate(line):
|
| - return
|
| - now = time.time()
|
| - match = self.PERCENT_RE.match(line)
|
| - if not match:
|
| - self.last_time = 0
|
| - if (now - self.last_time) >= self.time_throttle:
|
| - self.last_time = now
|
| - print line
|
| -
|
| -
|
| class GitWrapper(SCMWrapper):
|
| """Wrapper for Git"""
|
| name = 'git'
|
| @@ -1032,7 +994,7 @@ class GitWrapper(SCMWrapper):
|
| kwargs.setdefault('cwd', self.checkout_path)
|
| git_filter = not options.verbose
|
| if git_filter:
|
| - kwargs['filter_fn'] = GitFilter(kwargs.get('filter_fn'))
|
| + kwargs['filter_fn'] = gclient_utils.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/
|
|
|