Store up to 30000 packet log lines for git fetch.

We currently fetch tags, which consumes ~17k lines. This limit ensures that we
won't blow up the log files in exceptional circumstances [currently setting
around ~2MB], but still allows us to get all the logs.

Change-Id: Ib690aaa07e2bde8549d221b90511b6c4863c3358
Recipe-Nontrivial-Roll: chromiumos
Recipe-Nontrivial-Roll: skia
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1867971
Commit-Queue: Erik Chen <erikchen@chromium.org>
Auto-Submit: Erik Chen <erikchen@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@google.com>
changes/71/1867971/4
Erik Chen 6 years ago committed by Commit Bot
parent 16af35606f
commit fcde3ba0a6

@ -558,16 +558,16 @@ class Mirror(object):
'GIT_TRACE_PERFORMANCE': '1', 'GIT_TRACE_PERFORMANCE': '1',
'GIT_TRACE_SETUP': '1' 'GIT_TRACE_SETUP': '1'
}) })
# Only print first 30 packets. We can use nonlocal keyword once we # Only print first 30000 packets. We can use nonlocal keyword once we
# switch to python 3. # switch to python 3.
packet_count = [0] packet_count = [0]
def FilterPacket(log_line): def FilterPacket(log_line):
if 'packet:' in log_line: if 'packet:' in log_line:
packet_count[0] += 1 packet_count[0] += 1
if packet_count[0] == 30: if packet_count[0] == 30000:
self.print('Truncating remaining packets') self.print('Truncating remaining packets')
if packet_count[0] >= 30: if packet_count[0] >= 30000:
return return
self.print(log_line) self.print(log_line)

Loading…
Cancel
Save