From 2f8b0c1d8e23be801306b828f52e9416bd360094 Mon Sep 17 00:00:00 2001 From: Dan Jacques Date: Wed, 5 Apr 2017 12:57:21 -0700 Subject: [PATCH] git_retry: Disable retries under Git wrapper. If the Infra Git wrapper is managing a Git execution, "git_retry" will impose a second set of retries. Recognize this situation and disable "git_retry" so that the Git wrapper is the sole managing process. BUG=chromium:703868 TEST=local - Ran with and without environment variable, seems to work. Change-Id: I4f749c9693a761abe2a062ed5f1dc09f51c69e30 Reviewed-on: https://chromium-review.googlesource.com/469229 Commit-Queue: Daniel Jacques Reviewed-by: Robbie Iannucci --- git_common.py | 8 ++++++++ git_retry.py | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/git_common.py b/git_common.py index ab936cb17..78767e762 100644 --- a/git_common.py +++ b/git_common.py @@ -48,6 +48,14 @@ FREEZE_SECTIONS = { FREEZE_MATCHER = re.compile(r'%s.(%s)' % (FREEZE, '|'.join(FREEZE_SECTIONS))) +# NOTE: This list is DEPRECATED in favor of the Infra Git wrapper: +# https://chromium.googlesource.com/infra/infra/+/master/go/src/infra/tools/git +# +# New entries should be added to the Git wrapper, NOT to this list. "git_retry" +# is, similarly, being deprecated in favor of the Git wrapper. +# +# --- +# # Retry a git operation if git returns a error response with any of these # messages. It's all observed 'bad' GoB responses so far. # diff --git a/git_retry.py b/git_retry.py index d6dee6536..c153e12a7 100755 --- a/git_retry.py +++ b/git_retry.py @@ -3,8 +3,16 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. + +"""Generic retry wrapper for Git operations. + +This is largely DEPRECATED in favor of the Infra Git wrapper: +https://chromium.googlesource.com/infra/infra/+/master/go/src/infra/tools/git +""" + import logging import optparse +import os import subprocess import sys import threading @@ -111,6 +119,11 @@ class GitRetry(object): def main(args): + # If we're using the Infra Git wrapper, do nothing here. + # https://chromium.googlesource.com/infra/infra/+/master/go/src/infra/tools/git + if 'INFRA_GIT_WRAPPER' in os.environ: + return subprocess.call([GIT_EXE] + args) + parser = optparse.OptionParser() parser.disable_interspersed_args() parser.add_option('-v', '--verbose',