Commit b71b67e2 authored by maruel@chromium.org's avatar maruel@chromium.org

Add an automatic retry on some svn commands.

Subversion's client just bails out too early too often.

Review URL: http://codereview.chromium.org/437015

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@32967 0039d316-1c4b-4281-b951-d872f2087c98
parent ea452b3f
......@@ -165,19 +165,34 @@ class SVN(object):
'status': status_pattern,
'update': update_pattern,
}[args[0]]
compiled_pattern = re.compile(pattern)
def CaptureMatchingLines(line):
match = compiled_pattern.search(line)
if match:
file_list.append(match.group(1))
SVN.RunAndFilterOutput(args,
in_directory,
options.verbose,
True,
CaptureMatchingLines)
# Place an upper limit.
for i in range(1, 10):
previous_list_len = len(file_list)
failure = []
def CaptureMatchingLines(line):
match = compiled_pattern.search(line)
if match:
file_list.append(match.group(1))
if line.startswith('svn: '):
# We can't raise an exception. We can't alias a variable. Use a cheap
# way.
failure.append(True)
try:
SVN.RunAndFilterOutput(args,
in_directory,
options.verbose,
True,
CaptureMatchingLines)
except gclient_utils.Error:
# We enforce that some progress has been made.
if len(failure) and len(file_list) > previous_list_len:
if args[0] == 'checkout':
args = args[:]
# An aborted checkout is now an update.
args[0] = 'update'
continue
break
@staticmethod
def RunAndFilterOutput(args,
......
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