Commit Graph

155 Commits (7a9218d13f2d615a647b44c77441ea5e48fd5463)

Author SHA1 Message Date
Mike Frysinger 124bb8e53c switch to 4 space indent
Leave the recipes/ code at 2 space to match the rest of the recipes
project in other repos.

Reformatted using:
files=( $(
	git ls-tree -r --name-only HEAD | \
		grep -Ev -e '^(third_party|recipes)/' | \
		grep '\.py$';
	git grep -l '#!/usr/bin/env.*python' | grep -v '\.py$'
) )
parallel ./yapf -i -- "${files[@]}"
~/chromiumos/chromite/contrib/reflow_overlong_comments "${files[@]}"

The files that still had strings that were too long were manually
reformatted because they were easy and only a few issues.
autoninja.py
clang_format.py
download_from_google_storage.py
fix_encoding.py
gclient_utils.py
git_cache.py
git_common.py
git_map_branches.py
git_reparent_branch.py
gn.py
my_activity.py
owners_finder.py
presubmit_canned_checks.py
reclient_helper.py
reclientreport.py
roll_dep.py
rustfmt.py
siso.py
split_cl.py
subcommand.py
subprocess2.py
swift_format.py
upload_to_google_storage.py

These files still had lines (strings) that were too long, so the pylint
warnings were suppressed with a TODO.
auth.py
gclient.py
gclient_eval.py
gclient_paths.py
gclient_scm.py
gerrit_util.py
git_cl.py
presubmit_canned_checks.py
presubmit_support.py
scm.py

Change-Id: Ia6535c4f2c48d46b589ec1e791dde6c6b2ea858f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4836379
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
2 years ago
Josip Sokcevic 5146d78ee5 Set HEAD on repo init, not after downloading repo
git_cache incorrectly sets HEAD to main. It should be done during repo
initialization, and not after files are downloaded. Current
implementation overrides HEAD settings instead of keping whatever is on
remote.

R=aravindvasudev@google.com

Fixed: 1475252
Change-Id: Idba87e2774ecbf249630a207d284f91c0f4a8a38
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4820461
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
2 years ago
Gavin Mak cc97655889 Reland "Drop py2 support in gerrit and git related files"
This is a reland of commit b5c7f4b46c

Original change's description:
> Drop py2 support in gerrit and git related files
>
> python3 is the only supported version of python in depot_tools.
>
> Bug: 1475402
> Change-Id: Ie4ee18d297081b3aa0206b8d7ce6461819bff0ca
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4809560
> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
> Commit-Queue: Gavin Mak <gavinmak@google.com>

Bug: 1475402
Change-Id: I194180494071777b7b9dd91a5c8edabbbf5484c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4811218
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
2 years ago
Aravind Vasudevan bb14391a50 Remove unused imports from depot_tools scripts
This change removes some unused imports across depot_tools scripts.

Change-Id: Ic1112065ad1020fc4a3573d3fb9f137915ef439c
Bug: 1475776
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4812185
Auto-Submit: Aravind Vasudevan <aravindvasudev@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
2 years ago
Gavin Mak 42674f5d2d Revert "Drop py2 support in gerrit and git related files"
This reverts commit b5c7f4b46c.

Reason for revert: missing a replace for urlparse.urlparse

Original change's description:
> Drop py2 support in gerrit and git related files
>
> python3 is the only supported version of python in depot_tools.
>
> Bug: 1475402
> Change-Id: Ie4ee18d297081b3aa0206b8d7ce6461819bff0ca
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4809560
> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
> Commit-Queue: Gavin Mak <gavinmak@google.com>

Bug: 1475402
Change-Id: Idd00fdfe0b3d62785da2789a7dfcc9fbc79b6385
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4811623
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
2 years ago
Gavin Mak b5c7f4b46c Drop py2 support in gerrit and git related files
python3 is the only supported version of python in depot_tools.

Bug: 1475402
Change-Id: Ie4ee18d297081b3aa0206b8d7ce6461819bff0ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4809560
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
2 years ago
Joanna Wang ea99f9a083 Reland "Set --git-dir for git commands that may be executed in bare gits."
This reverts commit 1c4052d88a.

Reason for revert: Fixed by ensuring directory paths are absolute.

Original change's description:
> Revert "Set --git-dir for git commands that may be executed in bare gits."
>
> This reverts commit d9011c559b.
>
> Reason for revert: Breaks ChromeOS staging builders: b/296139378
>
> Original change's description:
> > Set --git-dir for git commands that may be executed in bare gits.
> >
> > Bug:b/294415576
> > Change-Id: I18ca8ebebf95e1c31e30aa1f5d62da3467df940f
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4778199
> > Auto-Submit: Joanna Wang <jojwang@chromium.org>
> > Reviewed-by: Gavin Mak <gavinmak@google.com>
> > Commit-Queue: Joanna Wang <jojwang@chromium.org>
>
> Bug: b/294415576
> Change-Id: Ie16f16a405fbdea4d925e03a0cfd1ac0260bb2d8
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4784102
> Commit-Queue: Jack Neus <jackneus@google.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Reviewed-by: Joanna Wang <jojwang@chromium.org>

Bug: b/294415576
Change-Id: I0e8b8c697db88d85836c013005fddafb25d46d8a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4784808
Auto-Submit: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Emily Shaffer <emilyshaffer@google.com>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
2 years ago
Jack Neus 1c4052d88a Revert "Set --git-dir for git commands that may be executed in bare gits."
This reverts commit d9011c559b.

Reason for revert: Breaks ChromeOS staging builders: b/296139378

Original change's description:
> Set --git-dir for git commands that may be executed in bare gits.
>
> Bug:b/294415576
> Change-Id: I18ca8ebebf95e1c31e30aa1f5d62da3467df940f
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4778199
> Auto-Submit: Joanna Wang <jojwang@chromium.org>
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Joanna Wang <jojwang@chromium.org>

Bug: b/294415576
Change-Id: Ie16f16a405fbdea4d925e03a0cfd1ac0260bb2d8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4784102
Commit-Queue: Jack Neus <jackneus@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Joanna Wang <jojwang@chromium.org>
2 years ago
Joanna Wang d9011c559b Set --git-dir for git commands that may be executed in bare gits.
Bug:b/294415576
Change-Id: I18ca8ebebf95e1c31e30aa1f5d62da3467df940f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4778199
Auto-Submit: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
2 years ago
Aravind Vasudevan 6eccb0e24c Reset git_cache mirror when HEAD points to master
master->main branch migration left the cache in some builders to have its HEAD still pointing to refs/heads/master. This causes bot_update to fail. If in this state, delete the cache and force bootstrap.

Bug: 1418866
Change-Id: Id716a013833d459ee37306d27b369099faf846ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4310522
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
2 years ago
Joanna Wang 5175d18f8a Remove branch option from git cache update-bootstrap.
in update_bootstrap, it's only used for `git number`.
without it git number defaults to `HEAD`
and
nothing seems to actually set the `branch` option
https://source.chromium.org/search?q=%22update-bootstrap%22

Should fix the following failure: http://shortn/_nLLz2nJAGS

Change-Id: I5f3eb8497133c1e5d2f964af969ca61ab6256330
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4080542
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
2 years ago
Alexander Thomas ca3ebf119e Revert "Reset origin/HEAD in git_cache if it points to master"
This reverts commit 63fea808b0.

Reason for revert: broke bot_update for dart, b/259380822

Original change's description:
> Reset origin/HEAD in git_cache if it points to master
>
> This change resets refs/remotes/origin/HEAD if it points to master. With the master to main migration going on with chromium repositories, some of the cached git repositories end up pointing to master instead of main. This change aids in fixing this issue.
>
> Bug: 1364030
> Change-Id: Ic181b0179daf7b2b842cff7f7187d94d9fb20007
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4029356
> Auto-Submit: Aravind Vasudevan <aravindvasudev@google.com>
> Reviewed-by: Josip Sokcevic <sokcevic@google.com>
> Commit-Queue: Josip Sokcevic <sokcevic@google.com>

Bug: 1364030
Change-Id: I96842c15eba886f5b95cdd10f323b907d5ea165d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4030304
Reviewed-by: Gavin Mak <gavinmak@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2 years ago
Aravind Vasudevan 63fea808b0 Reset origin/HEAD in git_cache if it points to master
This change resets refs/remotes/origin/HEAD if it points to master. With the master to main migration going on with chromium repositories, some of the cached git repositories end up pointing to master instead of main. This change aids in fixing this issue.

Bug: 1364030
Change-Id: Ic181b0179daf7b2b842cff7f7187d94d9fb20007
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4029356
Auto-Submit: Aravind Vasudevan <aravindvasudev@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
2 years ago
Josip Sokcevic d540d8b0cd [git-cache] Fix remove files recursively
os.remove can't be used to remove non empty directory. Use rmtree from
gclient_utils.

R=jojwang@google.com

Bug: 1372658
Change-Id: I5c08bad9778396cb9b1ec0bebe6287a0f3823fab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3950469
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
3 years ago
Joanna Wang 5b5ee2de1b [git-cache] Fix print log.
Bug: 1372658
Change-Id: I12ab46c8f32b64cf575bff087ed2f82072ebbf8f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3949430
Auto-Submit: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
3 years ago
Joanna Wang 17cf81d90a [git-cache] Fix path splitting.
Bug:1372658
Change-Id: I83627ecc8cee754a1830a9c4453c59bd9c01d728
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3946647
Auto-Submit: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
3 years ago
Joanna Wang 38d1673525 Prevent unexpected directories from being uploaded to google storage.
Bug: 1372658
Change-Id: Ifc19420ee703fcdd0ff8c3d53ddcfeabc499d605
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3938927
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
3 years ago
Joanna Wang b9d987ecdb Add print gsutil ls output for git_cache
Bug: 1370443
Change-Id: I113169a0fdfb3ea87f5f27ba066cce93b3ee6c91
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3938922
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
3 years ago
Joanna Wang 2c54a19bd0 git_cache: print gsutil command.
Bug: 1370443
Change-Id: If2cf31982b13a1f6ec9bb9fd6dccb9095e209d63
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3933833
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
3 years ago
Jack Neus 1601b3eba0 git_cache: wrap "git remote show" call in retries
BUG=b:236709670
TEST=none

Change-Id: I575dd82260acdbeef3c4c7607e2c2ac8020a44c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3749247
Commit-Queue: Jack Neus <jackneus@google.com>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
3 years ago
Josip Sokcevic a4b3602457 Use remote information about default branch
When initializing git_cache repository, we can't assume the default
branch is main. This results in HEAD pointing to invalid ref for repos
that don't have main branch.

Instead, fetch information from remote git repository.

R=gavinmak@google.com

Fixed: 1334889
Change-Id: I84e6d8e09c81bdae7e5e31af88973534431824e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3696906
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
3 years ago
Josip Sokcevic 4de5deacd4 Explicitly run everything with python3
R=aravindvasudev@google.com, gavinmak@google.com

Change-Id: Iaa5e960c6226dea3a0814c7cb778d952eafb1502
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3525960
Reviewed-by: Gavin Mak <gavinmak@google.com>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
3 years ago
Aravind Vasudevan c5f0cbb865 Use pylint 2.7 for depot_tools
This includes a few fixes for specific errors, and disables several new
warnings introduced in this version, in order to allow for an incremental migration.

Bug:1262286
Change-Id: I4b8f8fc521386419a3121bbb07edc8ac83170a94
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3413679
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
3 years ago
Josip Sokcevic 42c5bbbc96 Revert "Use pylint 2.7 for depot_tools"
This reverts commit 22bf605bb6.

Reason for revert: breaks gclient sync

Original change's description:
> Use pylint 2.7 for depot_tools
>
> This includes a few fixes for specific errors, and disables several new
> warnings introduced in this version, in order to allow for an incremental migration.
>
> Bug:1262286
> Change-Id: Ie97d686748c9c952e87718a65f401c5f6f80a5c9
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3400616
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>

Bug: 1262286
Change-Id: Ieb946073c7886c7bf056ce843a5a48e82becf7a5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3413672
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
3 years ago
Aravind Vasudevan 22bf605bb6 Use pylint 2.7 for depot_tools
This includes a few fixes for specific errors, and disables several new
warnings introduced in this version, in order to allow for an incremental migration.

Bug:1262286
Change-Id: Ie97d686748c9c952e87718a65f401c5f6f80a5c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3400616
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
3 years ago
Josip Sokcevic 35061445ba Improve error message when a commit is not found
Improve error message when gclient sync errors due to a bad commit.

R=aravindvasudev@google.com

Fixed: 1078864
Change-Id: I574c7f7d2b5419cf96a4b3a3e3c57e16baeeecf0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3362175
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
3 years ago
Josip Sokcevic 650f853ced Disable print for git for-each-ref in git_cache
The command is used for verification purposes when git index is fetched
from GS. The output is verbose for chromium/src and not useful at all.

R=gavinmak@google.com

Bug: 1255228
Change-Id: Ie95963a23ef397e9fd6ce7bcf959ec9964d21ba7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3227145
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
4 years ago
Josip Sokcevic 604f160239 Reland "Limit number of concurrent gsutil cp calls"
This is a reland of d3cfea0c78

Original change's description:
> Limit number of concurrent gsutil cp calls
>
> gsutil utilizes as many cores as possible, and will create many threads
> too. In combination with gclient doing the same thing (utilize as many
> cores as possible), this results in creating way too many processes and
> some builders are running out of resources (e.g. can't create threads).
>
> This limits number of gsutil cp commands in git_cache to two.
>
> R=apolito@google.com, dpranke@google.com
>
> Bug: 1255228, 1249003
> Change-Id: Ifcccaacde6c9e1c60c1da0a0bc5a3e512e158dcc
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3219900
> Reviewed-by: Dirk Pranke <dpranke@google.com>
> Commit-Queue: Josip Sokcevic <sokcevic@google.com>

Bug: 1255228, 1249003
Change-Id: I712bf5f625fd42992e7b5310ae005fad2633e1a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3223155
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
4 years ago
Josip Sokcevic 13225b70bc Force set HEAD to refs/heads/main for git_cache
We only build git_cache if main branch exists, and newly boostrap caches
have main as default. This sets HEAD for already boostrapped caches, in
case they were boostrapped before the default branch change.

R=gavinmak@google.com

Bug: 1251783
Change-Id: I715329ee06cf523f9fe2e6a324381dc5703bac34
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3218281
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
4 years ago
Josip Sokcevic 9fe4fb87a6 Revert "Limit number of concurrent gsutil cp calls"
This reverts commit d3cfea0c78.

Reason for revert: using self.GSUTIL_CP_SEMAPHORE instead of
global GSUTIL_CP_SEMAPHORE

Original change's description:
> Limit number of concurrent gsutil cp calls
>
> gsutil utilizes as many cores as possible, and will create many threads
> too. In combination with gclient doing the same thing (utilize as many
> cores as possible), this results in creating way too many processes and
> some builders are running out of resources (e.g. can't create threads).
>
> This limits number of gsutil cp commands in git_cache to two.
>
> R=​apolito@google.com, dpranke@google.com
>
> Bug: 1255228, 1249003
> Change-Id: Ifcccaacde6c9e1c60c1da0a0bc5a3e512e158dcc
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3219900
> Reviewed-by: Dirk Pranke <dpranke@google.com>
> Commit-Queue: Josip Sokcevic <sokcevic@google.com>

Bug: 1255228, 1249003
Change-Id: I0fde2477ea620c683b49efaa2a70262bd8e615e2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3221900
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Dirk Pranke <dpranke@google.com>
4 years ago
Josip Sokcevic d3cfea0c78 Limit number of concurrent gsutil cp calls
gsutil utilizes as many cores as possible, and will create many threads
too. In combination with gclient doing the same thing (utilize as many
cores as possible), this results in creating way too many processes and
some builders are running out of resources (e.g. can't create threads).

This limits number of gsutil cp commands in git_cache to two.

R=apolito@google.com, dpranke@google.com

Bug: 1255228, 1249003
Change-Id: Ifcccaacde6c9e1c60c1da0a0bc5a3e512e158dcc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3219900
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
4 years ago
Josip Sokcevic a40c1e1666 Make git_cache compatible with git <2.28
R=apolito@google.com

Bug: 1240982
Change-Id: Ibc13c58f35e4d08c5bd402137f08ac1b2e7ae106
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3104288
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
4 years ago
Josip Sokcevic 6f896d0bfc Set main as default branch for git_cache
Currently, git cache depends on the global default branch. Set it to
main explicitly instead.

Bug: 3082645, b/195975120
Change-Id: Ia9331d479dbe9547b6913c74bbf86852fff3a596
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3083251
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Anthony Polito <apolito@google.com>
4 years ago
Josip Sokcevic ee1a2c72b7 Bootstrap git_cache using main as default branch
Bug: 1238084
Change-Id: I805f1e7b294c5317adeb7206a021d173e045e8f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3082645
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Anthony Polito <apolito@google.com>
4 years ago
Edward Lesmes cb04744f32 Reland "git-cache: Start collecting metrics."
This is a reland of a84eaf515f

Original change's description:
> git-cache: Start collecting metrics.
>
> Change-Id: I36f4b37a78ad23d615e3f49f158e8de785d5214a
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2875855
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

Change-Id: I80091d78deb0b1aaba280572a1384848990d9d93
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2877262
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes 5009fd68ac Revert "git-cache: Start collecting metrics."
This reverts commit a84eaf515f.

Reason for revert:
Should not print notice.
https://logs.chromium.org/logs/infra-internal/buildbucket/cr-buildbucket.appspot.com/8848034039500209104/+/u/bot_update/stdout

Original change's description:
> git-cache: Start collecting metrics.
>
> Change-Id: I36f4b37a78ad23d615e3f49f158e8de785d5214a
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2875855
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

Change-Id: I5d73cfccbcfc75ec26c7ba7127c1320002224e47
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2876069
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
4 years ago
Edward Lesmes a84eaf515f git-cache: Start collecting metrics.
Change-Id: I36f4b37a78ad23d615e3f49f158e8de785d5214a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2875855
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes 07a683430c Reland "git-cache: Add option to fetch commits."
This is a reland of 4c67f856f0
Issues should have been fixed by crrev.com/c/2838026

Original change's description:
> git-cache: Add option to fetch commits.
>
> Add option to git cache to fetch commits.
> And use it in bot_update and gclient sync to make sure
> the needed commits are present on the checkout.
>
> Change-Id: I9e90da9e3be6e7bacf714b22bf0b735463e655b6
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2829942
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

Change-Id: Ie5a29737f5a75d28bc7c5c2f6cb99ec7f87cd9e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2841046
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes 93d80d8686 Revert "git-cache: Add option to fetch commits."
This reverts commit 4c67f856f0.

Reason for revert: crbug.com/1200657

Original change's description:
> git-cache: Add option to fetch commits.
>
> Add option to git cache to fetch commits.
> And use it in bot_update and gclient sync to make sure
> the needed commits are present on the checkout.
>
> Change-Id: I9e90da9e3be6e7bacf714b22bf0b735463e655b6
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2829942
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

Change-Id: I31a1defb26119bcb46894ab4084d626b65c45fed
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2837413
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
4 years ago
Edward Lesmes 4c67f856f0 git-cache: Add option to fetch commits.
Add option to git cache to fetch commits.
And use it in bot_update and gclient sync to make sure
the needed commits are present on the checkout.

Change-Id: I9e90da9e3be6e7bacf714b22bf0b735463e655b6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2829942
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Josip Sokcevic 67e12286df Add validation after downloading cache from GS
R=ehmaldonado@chromium.org, gavinmak@google.com

Bug: 1159123
Change-Id: I21aedd9e0c557f75d8c11e055013cc4a540ea20c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2595787
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
4 years ago
Gavin Mak e6a623392d [depot_tools] Use logging.warning
logging.warn is deprecated and should be replaced with logging.warning.

Bug:1097402
Change-Id: I55ce007bec47608eeafcf3cd9ac2b90f60073115
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2575621
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
4 years ago
Anthony Polito 90b4c0f76b add support for main in git_cache
Change-Id: I32dcd812b41518bd8e2ca50eae1862611ff577de
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2528797
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Anthony Polito <apolito@google.com>
4 years ago
Andrii Shyshkalov 46b91c04d1 git-cache: pack refs to reduce # of files downloaded.
I've observed today that V8 builder spends ~1 minute to download
a bunch of lose files representing tags[1]. This CL should
shrink ~2K files to just 72.

[1]
https://logs.chromium.org/logs/v8/buildbucket/cr-buildbucket.appspot.com/8865281064556718960/+/steps/initialization/0/steps/bot_update/0/stdout

R=jochen@chromium.org, machenbach@chromium.org

Change-Id: Ib8f245e6ed67ea91b53b22a8e4f729ab899a1cbc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2502476
Auto-Submit: Andrii Shyshkalov <tandrii@google.com>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Michael Moss 7748094578 Try to be more efficient with git-cache gargage collecting.
BUG=1092640,1027990
R=iannucci@google.com, tandrii@google.com

Change-Id: I5d14925dc2b6d7a6fd93b6db19cfb98e1ea8df25
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2257740
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Michael Moss <mmoss@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Andrii Shyshkalov 03a0d5b08c git-cache: delete support for internal repos.
It worked only because of an all-powerful service account on each bot,
which isn't the case any more.

R=sokcevic@google.com

Change-Id: Id66f9cc44cd416e5b61745c0f690d5a91b3b4c67
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2225976
Auto-Submit: Andrii Shyshkalov <tandrii@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Josip Sokcevic 14a83aec56 Reland "Use OS level locking in git_cache.py"
This is a reland of d3affaa624

Original change's description:
> Use OS level locking in git_cache.py
> 
> Without OS level locking it's possible to leave "lock" files on disk
> which will prevent next run to acquire those locks. This can easily
> happen if SIGKIL is issued.
> 
> R=apolito@google.com, ehmaldonado@chromium.org
> 
> Bug: 1049610
> Change-Id: Id87aa1376b9ea5ff0c2d14f3603636493ed1dd5b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2189333
> Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
> Commit-Queue: Josip Sokcevic <sokcevic@google.com>

Bug: 1049610
Change-Id: I58e65a10f7c779e0de1121ba7167c694996e390c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2211189
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
5 years ago
Josip Sokcevic 8f6bfe301f Revert "Use OS level locking in git_cache.py"
This reverts commit d3affaa624.

Reason for revert: no attribute ignore_lock

Original change's description:
> Use OS level locking in git_cache.py
> 
> Without OS level locking it's possible to leave "lock" files on disk
> which will prevent next run to acquire those locks. This can easily
> happen if SIGKIL is issued.
> 
> R=​apolito@google.com, ehmaldonado@chromium.org
> 
> Bug: 1049610
> Change-Id: Id87aa1376b9ea5ff0c2d14f3603636493ed1dd5b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2189333
> Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
> Commit-Queue: Josip Sokcevic <sokcevic@google.com>

TBR=iannucci@chromium.org,ehmaldonado@chromium.org,apolito@google.com,infra-scoped@luci-project-accounts.iam.gserviceaccount.com,sokcevic@google.com

Change-Id: Iecc963e0a99d7f59f3f8801e529839346f9fbaf3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1049610
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2211186
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
5 years ago
Josip Sokcevic d3affaa624 Use OS level locking in git_cache.py
Without OS level locking it's possible to leave "lock" files on disk
which will prevent next run to acquire those locks. This can easily
happen if SIGKIL is issued.

R=apolito@google.com, ehmaldonado@chromium.org

Bug: 1049610
Change-Id: Id87aa1376b9ea5ff0c2d14f3603636493ed1dd5b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2189333
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
5 years ago
Josip Sokcevic 6afaa6ca97 Prune branches that no longer exist on remote
If a local branch tracks removed remote tracking branch (e.g. foo) and
remote has a branch that starts with such name (e.g. foo/bar), git fetch
will fail. --prune flag removes any remote-tracking branches that no
longer exist.

R=apolito@google.com, ehmaldonado@chromium.org

Bug: 1079483
Change-Id: I9bc31bf961d52a86b6fa2342249971b99a003666
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2190341
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago