diff options
Diffstat (limited to 'subcmds')
-rw-r--r-- | subcmds/sync.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index 9b4a6147..97da6204 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -440,7 +440,7 @@ later is required to fix a server side protocol bug. | |||
440 | finally: | 440 | finally: |
441 | sem.release() | 441 | sem.release() |
442 | 442 | ||
443 | def _CheckoutOne(self, opt, project, lock, pm, err_event): | 443 | def _CheckoutOne(self, opt, project, lock, pm, err_event, err_results): |
444 | """Checkout work tree for one project | 444 | """Checkout work tree for one project |
445 | 445 | ||
446 | Args: | 446 | Args: |
@@ -452,6 +452,8 @@ later is required to fix a server side protocol bug. | |||
452 | lock held). | 452 | lock held). |
453 | err_event: We'll set this event in the case of an error (after printing | 453 | err_event: We'll set this event in the case of an error (after printing |
454 | out info about the error). | 454 | out info about the error). |
455 | err_results: A list of strings, paths to git repos where checkout | ||
456 | failed. | ||
455 | 457 | ||
456 | Returns: | 458 | Returns: |
457 | Whether the fetch was successful. | 459 | Whether the fetch was successful. |
@@ -496,6 +498,8 @@ later is required to fix a server side protocol bug. | |||
496 | raise | 498 | raise |
497 | finally: | 499 | finally: |
498 | if did_lock: | 500 | if did_lock: |
501 | if not success: | ||
502 | err_results.append(project.relpath) | ||
499 | lock.release() | 503 | lock.release() |
500 | finish = time.time() | 504 | finish = time.time() |
501 | self.event_log.AddSync(project, event_log.TASK_SYNC_LOCAL, | 505 | self.event_log.AddSync(project, event_log.TASK_SYNC_LOCAL, |
@@ -528,6 +532,7 @@ later is required to fix a server side protocol bug. | |||
528 | threads = set() | 532 | threads = set() |
529 | sem = _threading.Semaphore(syncjobs) | 533 | sem = _threading.Semaphore(syncjobs) |
530 | err_event = _threading.Event() | 534 | err_event = _threading.Event() |
535 | err_results = [] | ||
531 | 536 | ||
532 | for project in all_projects: | 537 | for project in all_projects: |
533 | # Check for any errors before running any more tasks. | 538 | # Check for any errors before running any more tasks. |
@@ -542,7 +547,8 @@ later is required to fix a server side protocol bug. | |||
542 | project=project, | 547 | project=project, |
543 | lock=lock, | 548 | lock=lock, |
544 | pm=pm, | 549 | pm=pm, |
545 | err_event=err_event) | 550 | err_event=err_event, |
551 | err_results=err_results) | ||
546 | if syncjobs > 1: | 552 | if syncjobs > 1: |
547 | t = _threading.Thread(target=self._CheckoutWorker, | 553 | t = _threading.Thread(target=self._CheckoutWorker, |
548 | kwargs=kwargs) | 554 | kwargs=kwargs) |
@@ -560,6 +566,9 @@ later is required to fix a server side protocol bug. | |||
560 | # If we saw an error, exit with code 1 so that other scripts can check. | 566 | # If we saw an error, exit with code 1 so that other scripts can check. |
561 | if err_event.isSet(): | 567 | if err_event.isSet(): |
562 | print('\nerror: Exited sync due to checkout errors', file=sys.stderr) | 568 | print('\nerror: Exited sync due to checkout errors', file=sys.stderr) |
569 | if err_results: | ||
570 | print('Failing repos:\n%s' % '\n'.join(err_results), | ||
571 | file=sys.stderr) | ||
563 | sys.exit(1) | 572 | sys.exit(1) |
564 | 573 | ||
565 | def _GCProjects(self, projects): | 574 | def _GCProjects(self, projects): |