Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 # Copyright (C) 2008 Evan Martin <martine@danga.com> | 6 # Copyright (C) 2008 Evan Martin <martine@danga.com> |
| 7 | 7 |
| 8 """A git-command for integrating reviews on Rietveld.""" | 8 """A git-command for integrating reviews on Rietveld.""" |
| 9 | 9 |
| 10 from distutils.version import LooseVersion | 10 from distutils.version import LooseVersion |
| (...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1248 color = Fore.GREEN | 1248 color = Fore.GREEN |
| 1249 elif not msgs: | 1249 elif not msgs: |
| 1250 # No message was sent. | 1250 # No message was sent. |
| 1251 color = Fore.RED | 1251 color = Fore.RED |
| 1252 elif msgs[-1]['sender'] != props.get('owner_email'): | 1252 elif msgs[-1]['sender'] != props.get('owner_email'): |
| 1253 color = Fore.YELLOW | 1253 color = Fore.YELLOW |
| 1254 else: | 1254 else: |
| 1255 color = Fore.BLUE | 1255 color = Fore.BLUE |
| 1256 output.put((b, i, color)) | 1256 output.put((b, i, color)) |
| 1257 | 1257 |
| 1258 threads = [threading.Thread(target=fetch, args=(b,)) for b in branches] | 1258 # Process one branch synchronously to work through authentication, then |
| 1259 # spawn threads to process all the other branches in parallel. | |
| 1260 first_branch = True | |
| 1261 threads = [] | |
| 1262 for b in branches: | |
| 1263 if first_branch: | |
| 1264 fetch(b) | |
| 1265 first_branch = False | |
| 1266 else: | |
| 1267 threads.append(threading.Thread(target=fetch, args=(b,))) | |
|
iannucci
2014/03/26 23:34:26
why not
if branches:
fetch(branches[0])
threa
Jason Robbins -- corp
2014/03/26 23:43:07
I had it that way until I realized that branches i
| |
| 1268 | |
| 1259 for t in threads: | 1269 for t in threads: |
| 1260 t.daemon = True | 1270 t.daemon = True |
| 1261 t.start() | 1271 t.start() |
| 1262 else: | 1272 else: |
| 1263 # Do not use GetApprovingReviewers(), since it requires an HTTP request. | 1273 # Do not use GetApprovingReviewers(), since it requires an HTTP request. |
| 1264 for b in branches: | 1274 for b in branches: |
| 1265 c = Changelist(branchref=b) | 1275 c = Changelist(branchref=b) |
| 1266 url = c.GetIssueURL() | 1276 url = c.GetIssueURL() |
| 1267 output.put((b, url, Fore.BLUE if url else Fore.WHITE)) | 1277 output.put((b, url, Fore.BLUE if url else Fore.WHITE)) |
| 1268 | 1278 |
| (...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2540 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 2550 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
| 2541 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 2551 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
| 2542 | 2552 |
| 2543 | 2553 |
| 2544 if __name__ == '__main__': | 2554 if __name__ == '__main__': |
| 2545 # These affect sys.stdout so do it outside of main() to simplify mocks in | 2555 # These affect sys.stdout so do it outside of main() to simplify mocks in |
| 2546 # unit testing. | 2556 # unit testing. |
| 2547 fix_encoding.fix_encoding() | 2557 fix_encoding.fix_encoding() |
| 2548 colorama.init() | 2558 colorama.init() |
| 2549 sys.exit(main(sys.argv[1:])) | 2559 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |