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 # 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): |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 r'Connection timed out', | 85 r'Connection timed out', |
86 | 86 |
87 # crbug.com/430343 | 87 # crbug.com/430343 |
88 # TODO(dnj): Resync with Chromite. | 88 # TODO(dnj): Resync with Chromite. |
89 r'The requested URL returned error: 5\d+', | 89 r'The requested URL returned error: 5\d+', |
90 ) | 90 ) |
91 | 91 |
92 GIT_TRANSIENT_ERRORS_RE = re.compile('|'.join(GIT_TRANSIENT_ERRORS), | 92 GIT_TRANSIENT_ERRORS_RE = re.compile('|'.join(GIT_TRANSIENT_ERRORS), |
93 re.IGNORECASE) | 93 re.IGNORECASE) |
94 | 94 |
95 # First version where the for-each-ref command's format string supported the | 95 # git's for-each-ref command first supported the upstream:track token in its |
96 # upstream:track token. | 96 # format string in version 1.9.0, but some usages were broken until 2.3.0. |
97 MIN_UPSTREAM_TRACK_GIT_VERSION = (1, 9) | 97 # See git commit b6160d95 for more information. |
| 98 MIN_UPSTREAM_TRACK_GIT_VERSION = (2, 3) |
98 | 99 |
99 class BadCommitRefException(Exception): | 100 class BadCommitRefException(Exception): |
100 def __init__(self, refs): | 101 def __init__(self, refs): |
101 msg = ('one of %s does not seem to be a valid commitref.' % | 102 msg = ('one of %s does not seem to be a valid commitref.' % |
102 str(refs)) | 103 str(refs)) |
103 super(BadCommitRefException, self).__init__(msg) | 104 super(BadCommitRefException, self).__init__(msg) |
104 | 105 |
105 | 106 |
106 def memoize_one(**kwargs): | 107 def memoize_one(**kwargs): |
107 """Memoizes a single-argument pure function. | 108 """Memoizes a single-argument pure function. |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 hash=branch_hash, upstream=upstream_branch, ahead=ahead, behind=behind) | 810 hash=branch_hash, upstream=upstream_branch, ahead=ahead, behind=behind) |
810 | 811 |
811 # 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 |
812 # and deleted upstream branches). | 813 # and deleted upstream branches). |
813 missing_upstreams = {} | 814 missing_upstreams = {} |
814 for info in info_map.values(): | 815 for info in info_map.values(): |
815 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: |
816 missing_upstreams[info.upstream] = None | 817 missing_upstreams[info.upstream] = None |
817 | 818 |
818 return dict(info_map.items() + missing_upstreams.items()) | 819 return dict(info_map.items() + missing_upstreams.items()) |
OLD | NEW |