Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(824)

Unified Diff: scm.py

Issue 437015: Add an automatic retry on some svn commands. (Closed)
Patch Set: Now working! Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scm.py
diff --git a/scm.py b/scm.py
index 99dccf97496c8334cf8f8ad5a588721093e7572c..58f26c6a9855f4b85ea8132d7f535d1bb7a6a2a7 100644
--- a/scm.py
+++ b/scm.py
@@ -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,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698