mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
git-cache: add --gc-aggressive support.
This will be used on internal cache updater. For instance, I've just compressed chromium/src resulting bootstrap files from 20GiB to 7.5 GiB. R=ehmaldonado Change-Id: I15411700eb2ac3a26d1c658a12288cc49e48fd48 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1802877 Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org> Commit-Queue: Andrii Shyshkalov <tandrii@google.com>
This commit is contained in:
committed by
Commit Bot
parent
d4d1ba4971
commit
dcfe55f13f
11
git_cache.py
11
git_cache.py
@@ -572,7 +572,7 @@ class Mirror(object):
|
||||
if not ignore_lock:
|
||||
lockfile.unlock()
|
||||
|
||||
def update_bootstrap(self, prune=False):
|
||||
def update_bootstrap(self, prune=False, gc_aggressive=False):
|
||||
# The folder is <git number>
|
||||
gen_number = subprocess.check_output(
|
||||
[self.git_exe, 'number', 'master'], cwd=self.mirror_path).strip()
|
||||
@@ -592,7 +592,10 @@ class Mirror(object):
|
||||
return
|
||||
|
||||
# Run Garbage Collect to compress packfile.
|
||||
self.RunGit(['gc', '--prune=all'])
|
||||
gc_args = ['gc', '--prune=all']
|
||||
if gc_aggressive:
|
||||
gc_args.append('--aggressive')
|
||||
self.RunGit(gc_args)
|
||||
|
||||
gsutil.call('-m', 'cp', '-r', src_name, dest_prefix)
|
||||
|
||||
@@ -699,6 +702,8 @@ def CMDupdate_bootstrap(parser, args):
|
||||
print('Sorry, update bootstrap will not work on Windows.', file=sys.stderr)
|
||||
return 1
|
||||
|
||||
parser.add_option('--gc-aggressive', action='store_true',
|
||||
help='Run aggressive repacking of the repo.')
|
||||
parser.add_option('--prune', action='store_true',
|
||||
help='Prune all other cached bundles of the same repo.')
|
||||
|
||||
@@ -710,7 +715,7 @@ def CMDupdate_bootstrap(parser, args):
|
||||
options, args = parser.parse_args(args)
|
||||
url = args[0]
|
||||
mirror = Mirror(url)
|
||||
mirror.update_bootstrap(options.prune)
|
||||
mirror.update_bootstrap(options.prune, options.gc_aggressive)
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user