Commit fd843fa4 authored by Erik Chen's avatar Erik Chen Committed by Commit Bot

Add diagnostics to git_cache.

These confirm that we're correctly using protocol v2.

Change-Id: Ib8bd8a4dba27d44fc0ae14835ce5253dfa056318
Recipe-Nontrivial-Roll: skia
Recipe-Nontrivial-Roll: chromiumos
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1867195
Commit-Queue: Erik Chen <erikchen@chromium.org>
Auto-Submit: Erik Chen <erikchen@chromium.org>
Reviewed-by: 's avatarAndrii Shyshkalov <tandrii@google.com>
parent b594247e
......@@ -355,6 +355,14 @@ class Mirror(object):
if cwd is None:
cwd = self.mirror_path
# Print diagnostics and ignore errors.
try:
self.print('git exe: %s' % (self.git_exe,))
self.RunGit(['version'], cwd=cwd)
self.RunGit(['config', 'protocol.version'], cwd=cwd)
except subprocess.CalledProcessError as e:
pass
if reset_fetch_config:
try:
self.RunGit(['config', '--unset-all', 'remote.origin.fetch'], cwd=cwd)
......@@ -544,8 +552,32 @@ class Mirror(object):
spec = spec.decode()
try:
self.print('Fetching %s' % spec)
env = os.environ.copy()
env.update({
'GIT_TRACE_PACKET': '1',
'GIT_TRACE_PERFORMANCE': '1',
'GIT_TRACE_SETUP': '1'
})
# Only print first 30 packets. We can use nonlocal keyword once we
# switch to python 3.
packet_count = [0]
def FilterPacket(log_line):
if 'packet:' in log_line:
packet_count[0] += 1
if packet_count[0] == 30:
self.print('Truncating remaining packets')
if packet_count[0] >= 30:
return
self.print(log_line)
with self.print_duration_of('fetch %s' % spec):
self.RunGit(fetch_cmd + [spec], cwd=rundir, retry=True)
self.RunGit(
fetch_cmd + [spec],
cwd=rundir,
retry=True,
env=env,
filter_fn=FilterPacket)
except subprocess.CalledProcessError:
if spec == '+refs/heads/*:refs/heads/*':
raise ClobberNeeded() # Corrupted cache.
......
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