| 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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 return run('diff', oldrev, newrev, *args) | 398 return run('diff', oldrev, newrev, *args) |
| 399 | 399 |
| 400 | 400 |
| 401 def freeze(): | 401 def freeze(): |
| 402 took_action = False | 402 took_action = False |
| 403 key = 'depot-tools.freeze-size-limit' | 403 key = 'depot-tools.freeze-size-limit' |
| 404 MB = 2**20 | 404 MB = 2**20 |
| 405 limit_mb = get_config_int(key, 100) | 405 limit_mb = get_config_int(key, 100) |
| 406 untracked_bytes = 0 | 406 untracked_bytes = 0 |
| 407 | 407 |
| 408 root_path = repo_root() |
| 409 |
| 408 for f, s in status(): | 410 for f, s in status(): |
| 409 if is_unmerged(s): | 411 if is_unmerged(s): |
| 410 die("Cannot freeze unmerged changes!") | 412 die("Cannot freeze unmerged changes!") |
| 411 if limit_mb > 0: | 413 if limit_mb > 0: |
| 412 if s.lstat == '?': | 414 if s.lstat == '?': |
| 413 untracked_bytes += os.stat(f).st_size | 415 untracked_bytes += os.stat(os.path.join(root_path, f)).st_size |
| 414 if untracked_bytes > limit_mb * MB: | 416 if untracked_bytes > limit_mb * MB: |
| 415 die("""\ | 417 die("""\ |
| 416 You appear to have too much untracked+unignored data in your git | 418 You appear to have too much untracked+unignored data in your git |
| 417 checkout: %.1f / %d MB. | 419 checkout: %.1f / %d MB. |
| 418 | 420 |
| 419 Run `git status` to see what it is. | 421 Run `git status` to see what it is. |
| 420 | 422 |
| 421 In addition to making many git commands slower, this will prevent | 423 In addition to making many git commands slower, this will prevent |
| 422 depot_tools from freezing your in-progress changes. | 424 depot_tools from freezing your in-progress changes. |
| 423 | 425 |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 ['HEAD']) | 1011 ['HEAD']) |
| 1010 | 1012 |
| 1011 | 1013 |
| 1012 def clone_file(repository, new_workdir, link, operation): | 1014 def clone_file(repository, new_workdir, link, operation): |
| 1013 if not os.path.exists(os.path.join(repository, link)): | 1015 if not os.path.exists(os.path.join(repository, link)): |
| 1014 return | 1016 return |
| 1015 link_dir = os.path.dirname(os.path.join(new_workdir, link)) | 1017 link_dir = os.path.dirname(os.path.join(new_workdir, link)) |
| 1016 if not os.path.exists(link_dir): | 1018 if not os.path.exists(link_dir): |
| 1017 os.makedirs(link_dir) | 1019 os.makedirs(link_dir) |
| 1018 operation(os.path.join(repository, link), os.path.join(new_workdir, link)) | 1020 operation(os.path.join(repository, link), os.path.join(new_workdir, link)) |
| OLD | NEW |