Quellcode durchsuchen

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 <dnj@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Dan Jacques vor 8 Jahren
Ursprung
Commit
2f8b0c1d8e
2 geänderte Dateien mit 21 neuen und 0 gelöschten Zeilen
  1. 8 0
      git_common.py
  2. 13 0
      git_retry.py

+ 8 - 0
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.
 #

+ 13 - 0
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',