| 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 git config %s <new_limit> | 421 git config %s <new_limit> |
| 422 Where <new_limit> is an integer threshold in megabytes.""", | 422 Where <new_limit> is an integer threshold in megabytes.""", |
| 423 untracked_size, limit_mb, key) | 423 untracked_size, limit_mb, key) |
| 424 | 424 |
| 425 try: | 425 try: |
| 426 run('commit', '--no-verify', '-m', FREEZE + '.indexed') | 426 run('commit', '--no-verify', '-m', FREEZE + '.indexed') |
| 427 took_action = True | 427 took_action = True |
| 428 except subprocess2.CalledProcessError: | 428 except subprocess2.CalledProcessError: |
| 429 pass | 429 pass |
| 430 | 430 |
| 431 add_errors = False |
| 431 try: | 432 try: |
| 432 run('add', '-A') | 433 run('add', '-A', '--ignore-errors') |
| 434 except subprocess2.CalledProcessError: |
| 435 add_errors = True |
| 436 |
| 437 try: |
| 433 run('commit', '--no-verify', '-m', FREEZE + '.unindexed') | 438 run('commit', '--no-verify', '-m', FREEZE + '.unindexed') |
| 434 took_action = True | 439 took_action = True |
| 435 except subprocess2.CalledProcessError: | 440 except subprocess2.CalledProcessError: |
| 436 pass | 441 pass |
| 437 | 442 |
| 443 ret = [] |
| 444 if add_errors: |
| 445 ret.append('Failed to index some unindexed files.') |
| 438 if not took_action: | 446 if not took_action: |
| 439 return 'Nothing to freeze.' | 447 ret.append('Nothing to freeze.') |
| 448 return ' '.join(ret) or None |
| 440 | 449 |
| 441 | 450 |
| 442 def get_branch_tree(): | 451 def get_branch_tree(): |
| 443 """Get the dictionary of {branch: parent}, compatible with topo_iter. | 452 """Get the dictionary of {branch: parent}, compatible with topo_iter. |
| 444 | 453 |
| 445 Returns a tuple of (skipped, <branch_tree dict>) where skipped is a set of | 454 Returns a tuple of (skipped, <branch_tree dict>) where skipped is a set of |
| 446 branches without upstream branches defined. | 455 branches without upstream branches defined. |
| 447 """ | 456 """ |
| 448 skipped = set() | 457 skipped = set() |
| 449 branch_tree = {} | 458 branch_tree = {} |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 ['HEAD']) | 1004 ['HEAD']) |
| 996 | 1005 |
| 997 | 1006 |
| 998 def clone_file(repository, new_workdir, link, operation): | 1007 def clone_file(repository, new_workdir, link, operation): |
| 999 if not os.path.exists(os.path.join(repository, link)): | 1008 if not os.path.exists(os.path.join(repository, link)): |
| 1000 return | 1009 return |
| 1001 link_dir = os.path.dirname(os.path.join(new_workdir, link)) | 1010 link_dir = os.path.dirname(os.path.join(new_workdir, link)) |
| 1002 if not os.path.exists(link_dir): | 1011 if not os.path.exists(link_dir): |
| 1003 os.makedirs(link_dir) | 1012 os.makedirs(link_dir) |
| 1004 operation(os.path.join(repository, link), os.path.join(new_workdir, link)) | 1013 operation(os.path.join(repository, link), os.path.join(new_workdir, link)) |
| OLD | NEW |