| 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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 try: | 350 try: |
| 351 run('config', '--' + scope, '--unset', option) | 351 run('config', '--' + scope, '--unset', option) |
| 352 except subprocess2.CalledProcessError: | 352 except subprocess2.CalledProcessError: |
| 353 pass | 353 pass |
| 354 | 354 |
| 355 | 355 |
| 356 def freeze(): | 356 def freeze(): |
| 357 took_action = False | 357 took_action = False |
| 358 | 358 |
| 359 try: | 359 try: |
| 360 run('commit', '-m', FREEZE + '.indexed') | 360 run('commit', '--no-verify', '-m', FREEZE + '.indexed') |
| 361 took_action = True | 361 took_action = True |
| 362 except subprocess2.CalledProcessError: | 362 except subprocess2.CalledProcessError: |
| 363 pass | 363 pass |
| 364 | 364 |
| 365 try: | 365 try: |
| 366 run('add', '-A') | 366 run('add', '-A') |
| 367 run('commit', '-m', FREEZE + '.unindexed') | 367 run('commit', '--no-verify', '-m', FREEZE + '.unindexed') |
| 368 took_action = True | 368 took_action = True |
| 369 except subprocess2.CalledProcessError: | 369 except subprocess2.CalledProcessError: |
| 370 pass | 370 pass |
| 371 | 371 |
| 372 if not took_action: | 372 if not took_action: |
| 373 return 'Nothing to freeze.' | 373 return 'Nothing to freeze.' |
| 374 | 374 |
| 375 | 375 |
| 376 def get_branch_tree(): | 376 def get_branch_tree(): |
| 377 """Get the dictionary of {branch: parent}, compatible with topo_iter. | 377 """Get the dictionary of {branch: parent}, compatible with topo_iter. |
| (...skipping 432 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 |