Browse Source

[git-cache] Add option to update_bootstrap to skip the populate step.

This will allow us to separate the 'populate' and 'upload' phases
in the git cache updater recipe, which will allow us to do all the
'populate' steps in parallel, but then limit the parallelism of the
`pack/gc/upload` operations.

R=tandrii@chromium.org

Change-Id: I8b8a9155f86350be37ed5a67c592ff1fec4d42ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1830857
Auto-Submit: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@google.com>
Reviewed-by: Andrii Shyshkalov <tandrii@google.com>
Robert Iannucci 5 năm trước cách đây
mục cha
commit
0081c0ff17
1 tập tin đã thay đổi với 9 bổ sung2 xóa
  1. 9 2
      git_cache.py

+ 9 - 2
git_cache.py

@@ -700,14 +700,21 @@ def CMDupdate_bootstrap(parser, args):
     print('Sorry, update bootstrap will not work on Windows.', file=sys.stderr)
     print('Sorry, update bootstrap will not work on Windows.', file=sys.stderr)
     return 1
     return 1
 
 
+  parser.add_option('--skip-populate', action='store_true',
+                    help='Skips "populate" step if mirror already exists.')
   parser.add_option('--gc-aggressive', action='store_true',
   parser.add_option('--gc-aggressive', action='store_true',
                     help='Run aggressive repacking of the repo.')
                     help='Run aggressive repacking of the repo.')
   parser.add_option('--prune', action='store_true',
   parser.add_option('--prune', action='store_true',
                     help='Prune all other cached bundles of the same repo.')
                     help='Prune all other cached bundles of the same repo.')
 
 
-  # First, we need to ensure the cache is populated.
   populate_args = args[:]
   populate_args = args[:]
-  CMDpopulate(parser, populate_args)
+  options, args = parser.parse_args(args)
+  url = args[0]
+  mirror = Mirror(url)
+  if not options.skip_populate or not mirror.exists():
+    CMDpopulate(parser, populate_args)
+  else:
+    print('Skipped populate step.')
 
 
   # Get the repo directory.
   # Get the repo directory.
   options, args = parser.parse_args(args)
   options, args = parser.parse_args(args)