diff options
Diffstat (limited to 'subcmds/status.py')
-rw-r--r-- | subcmds/status.py | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/subcmds/status.py b/subcmds/status.py index dc223a00..1b48dcea 100644 --- a/subcmds/status.py +++ b/subcmds/status.py | |||
@@ -15,10 +15,9 @@ | |||
15 | import functools | 15 | import functools |
16 | import glob | 16 | import glob |
17 | import io | 17 | import io |
18 | import multiprocessing | ||
19 | import os | 18 | import os |
20 | 19 | ||
21 | from command import DEFAULT_LOCAL_JOBS, PagedCommand, WORKER_BATCH_SIZE | 20 | from command import DEFAULT_LOCAL_JOBS, PagedCommand |
22 | 21 | ||
23 | from color import Coloring | 22 | from color import Coloring |
24 | import platform_utils | 23 | import platform_utils |
@@ -119,22 +118,23 @@ the following meanings: | |||
119 | 118 | ||
120 | def Execute(self, opt, args): | 119 | def Execute(self, opt, args): |
121 | all_projects = self.GetProjects(args) | 120 | all_projects = self.GetProjects(args) |
122 | counter = 0 | ||
123 | 121 | ||
124 | if opt.jobs == 1: | 122 | def _ProcessResults(_pool, _output, results): |
125 | for project in all_projects: | 123 | ret = 0 |
126 | state = project.PrintWorkTreeStatus(quiet=opt.quiet) | 124 | for (state, output) in results: |
125 | if output: | ||
126 | print(output, end='') | ||
127 | if state == 'CLEAN': | 127 | if state == 'CLEAN': |
128 | counter += 1 | 128 | ret += 1 |
129 | else: | 129 | return ret |
130 | with multiprocessing.Pool(opt.jobs) as pool: | 130 | |
131 | states = pool.imap(functools.partial(self._StatusHelper, opt.quiet), | 131 | counter = self.ExecuteInParallel( |
132 | all_projects, chunksize=WORKER_BATCH_SIZE) | 132 | opt.jobs, |
133 | for (state, output) in states: | 133 | functools.partial(self._StatusHelper, opt.quiet), |
134 | if output: | 134 | all_projects, |
135 | print(output, end='') | 135 | callback=_ProcessResults, |
136 | if state == 'CLEAN': | 136 | ordered=True) |
137 | counter += 1 | 137 | |
138 | if not opt.quiet and len(all_projects) == counter: | 138 | if not opt.quiet and len(all_projects) == counter: |
139 | print('nothing to commit (working directory clean)') | 139 | print('nothing to commit (working directory clean)') |
140 | 140 | ||