| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 # Monkeypatch IMapIterator so that Ctrl-C can kill everything properly. | 5 # Monkeypatch IMapIterator so that Ctrl-C can kill everything properly. |
| 6 # Derived from https://gist.github.com/aljungberg/626518 | 6 # Derived from https://gist.github.com/aljungberg/626518 |
| 7 import multiprocessing.pool | 7 import multiprocessing.pool |
| 8 from multiprocessing.pool import IMapIterator | 8 from multiprocessing.pool import IMapIterator |
| 9 def wrapper(func): | 9 def wrapper(func): |
| 10 def wrap(self, timeout=None): | 10 def wrap(self, timeout=None): |
| 11 return func(self, timeout=timeout or 1e100) | 11 return func(self, timeout=timeout or 1e100) |
| 12 return wrap | 12 return wrap |
| 13 IMapIterator.next = wrapper(IMapIterator.next) | 13 IMapIterator.next = wrapper(IMapIterator.next) |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 hash=branch_hash, upstream=upstream_branch, ahead=ahead, behind=behind) | 810 hash=branch_hash, upstream=upstream_branch, ahead=ahead, behind=behind) |
| 811 | 811 |
| 812 # Set None for upstreams which are not branches (e.g empty upstream, remotes | 812 # Set None for upstreams which are not branches (e.g empty upstream, remotes |
| 813 # and deleted upstream branches). | 813 # and deleted upstream branches). |
| 814 missing_upstreams = {} | 814 missing_upstreams = {} |
| 815 for info in info_map.values(): | 815 for info in info_map.values(): |
| 816 if info.upstream not in info_map and info.upstream not in missing_upstreams: | 816 if info.upstream not in info_map and info.upstream not in missing_upstreams: |
| 817 missing_upstreams[info.upstream] = None | 817 missing_upstreams[info.upstream] = None |
| 818 | 818 |
| 819 return dict(info_map.items() + missing_upstreams.items()) | 819 return dict(info_map.items() + missing_upstreams.items()) |
| OLD | NEW |