OLD | NEW |
1 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """SCM-specific utility classes.""" | 5 """SCM-specific utility classes.""" |
6 | 6 |
7 import glob | 7 import glob |
8 import os | 8 import os |
9 import re | 9 import re |
10 import shutil | 10 import shutil |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 # way. | 373 # way. |
374 failure.append(True) | 374 failure.append(True) |
375 | 375 |
376 try: | 376 try: |
377 SVN.RunAndFilterOutput(args, | 377 SVN.RunAndFilterOutput(args, |
378 in_directory, | 378 in_directory, |
379 options.verbose, | 379 options.verbose, |
380 True, | 380 True, |
381 CaptureMatchingLines) | 381 CaptureMatchingLines) |
382 except gclient_utils.Error: | 382 except gclient_utils.Error: |
383 # We enforce that some progress has been made. | 383 # We enforce that some progress has been made or HTTP 502. |
384 if len(failure) and len(file_list) > previous_list_len: | 384 if ([True for f in failure if '502 Bad Gateway' in f] or |
| 385 (len(failure) and len(file_list) > previous_list_len)): |
385 if args[0] == 'checkout': | 386 if args[0] == 'checkout': |
386 args = args[:] | |
387 # An aborted checkout is now an update. | 387 # An aborted checkout is now an update. |
388 args[0] = 'update' | 388 args = ['update'] + args[1:] |
389 continue | 389 continue |
390 # No progress was made, bail out. | 390 # No progress was made or an unknown error we aren't sure, bail out. |
391 raise | 391 raise |
392 break | 392 break |
393 | 393 |
394 @staticmethod | 394 @staticmethod |
395 def RunAndFilterOutput(args, | 395 def RunAndFilterOutput(args, |
396 in_directory, | 396 in_directory, |
397 print_messages, | 397 print_messages, |
398 print_stdout, | 398 print_stdout, |
399 filter): | 399 filter): |
400 """Runs a command, optionally outputting to stdout. | 400 """Runs a command, optionally outputting to stdout. |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 if not cur_dir_repo_root: | 729 if not cur_dir_repo_root: |
730 return None | 730 return None |
731 | 731 |
732 while True: | 732 while True: |
733 parent = os.path.dirname(directory) | 733 parent = os.path.dirname(directory) |
734 if (SVN.CaptureInfo(parent, print_error=False).get( | 734 if (SVN.CaptureInfo(parent, print_error=False).get( |
735 "Repository Root") != cur_dir_repo_root): | 735 "Repository Root") != cur_dir_repo_root): |
736 break | 736 break |
737 directory = parent | 737 directory = parent |
738 return GetCasedPath(directory) | 738 return GetCasedPath(directory) |
OLD | NEW |