-
Andrii Shyshkalov authored
Goal: reduce number of git fetches from remote to the minimum possible. Minimum possible is either: * 0 if desired revision is pinned (!= HEAD) and already exists in cache * 1 if desired revision is HEAD * >= 2 if revision is pinned but we talk temporarily out-of-date git server not yet having it. This CL achieves the above. No fetch: https://ci.chromium.org/swarming/task/39dad20230c84110?server=chromium-swarm.appspot.com bot_update takes <1min, but it used to take at least 2. The steps are now like this: ... ===Running git cat-file -e 33bf8a94dcd5e0abbdf83e4afaed24b5180e3eb2=== In directory: /b/swarming/w/ir/cache/git/chromium.googlesource.com-chromium-src ===Succeeded in 0.0 mins=== ===Running /b/swarming/w/ir/cipd_bin_packages/bin/python -u /b/swarming/w/ir/recipe-checkout-dir/depot_tools/git_cache.py exists --quiet --cache-dir /b/swarming/w/ir/cache/git https://chromium.googlesource.com/chromium/src.git=== In directory: /b/swarming/w/ir/cache/builder/linux /b/swarming/w/ir/cache/git/chromium.googlesource.com-chromium-src ===Succeeded in 0.0 mins=== ===Running git remote set-url origin /b/swarming/w/ir/cache/git/chromium.googlesource.com-chromium-src=== In directory: /b/swarming/w/ir/cache/builder/linux/src ===Succeeded in 0.0 mins=== ===Running git fetch origin=== In directory: /b/swarming/w/ir/cache/builder/linux/src From /b/swarming/w/ir/cache/git/chromium.googlesource.com-chromium-src 003eedbfee47..5210107a20e8 master -> origin/master ===Succeeded in 0.0 mins=== ===Running git checkout --force 33bf8a94dcd5e0abbdf83e4afaed24b5180e3eb2=== ... Fetch & success: https://ci.chromium.org/swarming/task/39db022b874ffd10?server=chromium-swarm.appspot.com Fetch & retry because missing rev: https://ci.chromium.org/swarming/task/39db04ce8b4b8910?server=chromium-swarm.appspot.com Fetch because rev=HEAD: https://ci.chromium.org/swarming/task/39db0c0dd5ab5d10?server=chromium-swarm.appspot.com This has already been adopted in gclient. Bug: Change-Id: Id99892b62719fdf3f7e6e59058986d1500384f8d Reviewed-on: https://chromium-review.googlesource.com/771591 Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org> Reviewed-by: Robbie Iannucci <iannucci@chromium.org> Reviewed-by: Jao-ke Chin-Lee <jchinlee@chromium.org>
cd33775a