diff options
Diffstat (limited to 'subcmds/upload.py')
-rw-r--r-- | subcmds/upload.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/subcmds/upload.py b/subcmds/upload.py index 8039a1cd..6344ee31 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py | |||
@@ -713,16 +713,17 @@ Gerrit Code Review: https://www.gerritcodereview.com/ | |||
713 | merge_branch = p.stdout.strip() | 713 | merge_branch = p.stdout.strip() |
714 | return merge_branch | 714 | return merge_branch |
715 | 715 | ||
716 | @staticmethod | 716 | @classmethod |
717 | def _GatherOne(opt, project): | 717 | def _GatherOne(cls, opt, project_idx): |
718 | """Figure out the upload status for |project|.""" | 718 | """Figure out the upload status for |project|.""" |
719 | project = cls.get_parallel_context()["projects"][project_idx] | ||
719 | if opt.current_branch: | 720 | if opt.current_branch: |
720 | cbr = project.CurrentBranch | 721 | cbr = project.CurrentBranch |
721 | up_branch = project.GetUploadableBranch(cbr) | 722 | up_branch = project.GetUploadableBranch(cbr) |
722 | avail = [up_branch] if up_branch else None | 723 | avail = [up_branch] if up_branch else None |
723 | else: | 724 | else: |
724 | avail = project.GetUploadableBranches(opt.branch) | 725 | avail = project.GetUploadableBranches(opt.branch) |
725 | return (project, avail) | 726 | return (project_idx, avail) |
726 | 727 | ||
727 | def Execute(self, opt, args): | 728 | def Execute(self, opt, args): |
728 | projects = self.GetProjects( | 729 | projects = self.GetProjects( |
@@ -732,8 +733,9 @@ Gerrit Code Review: https://www.gerritcodereview.com/ | |||
732 | def _ProcessResults(_pool, _out, results): | 733 | def _ProcessResults(_pool, _out, results): |
733 | pending = [] | 734 | pending = [] |
734 | for result in results: | 735 | for result in results: |
735 | project, avail = result | 736 | project_idx, avail = result |
736 | if avail is None: | 737 | if avail is None: |
738 | project = projects[project_idx] | ||
737 | logger.error( | 739 | logger.error( |
738 | 'repo: error: %s: Unable to upload branch "%s". ' | 740 | 'repo: error: %s: Unable to upload branch "%s". ' |
739 | "You might be able to fix the branch by running:\n" | 741 | "You might be able to fix the branch by running:\n" |
@@ -746,12 +748,14 @@ Gerrit Code Review: https://www.gerritcodereview.com/ | |||
746 | pending.append(result) | 748 | pending.append(result) |
747 | return pending | 749 | return pending |
748 | 750 | ||
749 | pending = self.ExecuteInParallel( | 751 | with self.ParallelContext(): |
750 | opt.jobs, | 752 | self.get_parallel_context()["projects"] = projects |
751 | functools.partial(self._GatherOne, opt), | 753 | pending = self.ExecuteInParallel( |
752 | projects, | 754 | opt.jobs, |
753 | callback=_ProcessResults, | 755 | functools.partial(self._GatherOne, opt), |
754 | ) | 756 | range(len(projects)), |
757 | callback=_ProcessResults, | ||
758 | ) | ||
755 | 759 | ||
756 | if not pending: | 760 | if not pending: |
757 | if opt.branch is None: | 761 | if opt.branch is None: |