If git_cache.populate() gets interrupted midway, it can possibly leave
a git mirror in a state where only some commits are available. Cloning
such a repo results in an empty repository and causes subsequent git
checkout to fail.
If the sentient file exists, it indicates that the bootstrapping
process was interrupted. This CL updates git_cache.contains_revision()
such that it returns False if the sentient file exists. Then,
the caller can call mirror.populate() to re-populate the repo/rev.
Bug: 41488725
Change-Id: I24fd24e300f5a9f9349589496d6b5f3dacf71fd2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6491733
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Scott Lee <ddoman@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
The long_text includes stack_trace[1] which is very verbose and not
providing much value. If user really need stacktrace or long_text,
they can access it by going to the build page.
[1]: https://screenshot.googleplex.com/5dcPwjNrtizEVBK
Change-Id: I2c5a5c2703875906f4ccaa1c8b1e83fe3a2f6115
Bug: 404837554
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6486346
Reviewed-by: Gavin Mak <gavinmak@google.com>
Auto-Submit: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
The current gsutil download code silently fails when the connection
drops mid-download, as read() returns an empty buffer instead of raising
an exception. This may lead to errors such as "zipfile.BadZipFile: File
is not a zip file" on Chromium sync with freshly-bootstrapped
depot_tools when downloading gcs deps.
This change solves this by hardening the process:
- Use retry mechanism with exponential backoff for gsutil download
- Switch to urlretrieve, which looks at Content-Length
- Compare MD5 of the downloaded file with the value from API
- Move exponential_backoff_retry from git_cache.py to gclient_utils.py
Change-Id: I25242948399e01373eb2afd9352e5c78a889051d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6485485
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Auto-Submit: Aleksei Khoroshilov <akhoroshilov@brave.com>
Reviewed-by: Scott Lee <ddoman@chromium.org>
Chrome's first use of appending location data to a PRESUBMIT.py check
made Chrome's "all" PRESUBMIT.py builders fail:
https://ci.chromium.org/ui/p/chromium/builders/ci/linux-presubmit
That's presumably because they're trying to upload findings in a
context without a gerrit CL. This should hopefully fix that.
Bug: 413427415
Change-Id: Ib2cab5d2668fa4562e6b2f365811983c93d0591e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6489610
Commit-Queue: Ben Pastene <bpastene@chromium.org>
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
The current implementation relies on the current working directory,
when it traverses the file tree to find the nearest OWNERS. It also
causes an infinite loop when it cannot find any OWNERS.
This CL changes the implementation so that it works
no matter what the cwd is.
Bug: 412904761
Change-Id: Ic4e25217aa64bd2eb6514ccdd486fe3b57a82312
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6484531
Commit-Queue: Scott Lee <ddoman@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
In https://crrev.com/c/6442501, apply_patch_ref() was updated to
refresh the git cache when applying patches in gclient. However,
it causes an excessive number of logs to be created, particularly
for src/v8, as the repo has a huge number of branches.
This CL simply sets the verbose option with False,
ignoring the value in options.verbose.
Bug: 407795715
Change-Id: Ibf32ff67d23f41b398cca82372c17d7ca331db26
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6486489
Commit-Queue: Scott Lee <ddoman@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
The presubmit script could succeed with warnings. We do want to show
those warnings in the Gerrit CL as well.
Change-Id: Iab6e420261d8cfc8baad18b3b2b8b6f9718776a8
Bug: 404837554
Recipe-Manual-Change: build
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6486226
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Auto-Submit: Yiwei Zhang <yiwzhang@google.com>
This option is already available for gclient revinfo. Adding it
to gclient sync means we get to reuse the filtering logic
already being used for revinfo.
Bug: 411662322
Change-Id: I6bd5e1cffe583247a497358ada1e0b82d0be986d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6481194
Reviewed-by: Scott Lee <ddoman@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Code findings will be uploaded to resultdb. If resultdb is not
enabled, exception will be thrown.
Bug: 404837554
Change-Id: I76ff82d6ecdd987fe08fdd703b67a1171d85eed0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6479007
Commit-Queue: Gavin Mak <gavinmak@google.com>
Auto-Submit: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
The recipe will convert presubmit result to finding as long as it has
location data.
Change-Id: I8e0ce4cf5f66d6236f10c21a6db87d293b3fe379
Bug: 404837554
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6469944
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
This will help us to display preusbmit result as findings both in
Gerrit and in Cider workspaces.
Change-Id: I0f5a9c503c1b14dc8dcbf9794cc556ef215a46a2
Bug: 404837554
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6469939
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
As part of an effort to make split_cl.py less monolithic, this
collects the parts of SplitCl related to the CL description, and
puts them into a separate function.
Bug: 389069356
Change-Id: I2d01c09799182cd57bcdd60bb000b59e3bc71aa9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6470263
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Devon Loehr <dloehr@google.com>
Refine the post-mirror-update check in `_UpdateMirrorIfNotContains` to
verify only when the hash revision is a SHA-1 hash. This fixes a
regression where syncing refs under refs/changes/* fails because the
check was incorrectly applied to non-hash revision strings.
Bug: 407864212, 341208163
Change-Id: I07dfe29fa7f27f6c69fa281762779e305e83b91f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6469936
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
As part of an effort to make split_cl.py more monolithic, this
separates out the code which summarizes the splitting, prompts
the user to edit it, and validates it afterwards.
This also fixes a bug where interactively-edited files bypassed branch validation.
Bug: 389069356
Change-Id: I498596a5ed624190fb355951049252c8b1d615fb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6469475
Commit-Queue: Devon Loehr <dloehr@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
As part of an effort to make split_cl.py less monolithic, this
separates out the part of SplitCl which gathers basic information
about the git repository.
Bug: 389069356
Change-Id: Ib005e352aa024dab8ff69417865d2d766732af0a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6471062
Commit-Queue: Devon Loehr <dloehr@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
As part of a cleanup effort to make this script's major functions
less monolithic, this moves the part of SplitCL responsible for
computing a splitting into its own function.
Bug: 389069356
Change-Id: I1f8571d7bf27018da6c25263a05ad098e7d05836
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6469473
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Devon Loehr <dloehr@google.com>
I believe Git will try to run the file without extension (this bash
file) directly, which causes issues.
Bug: 410753790
Change-Id: I3a43dfd84e6459f64a023d3c656d8d3ff3b7bd5e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6463456
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Make it consistent with the other line that uses "yet"
Change-Id: I6cae354b61ac673bb4d93a878daf01cebbf67a0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6459922
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Most users who access this have SSO, but there are some people with,
e.g., read access without SSO.
So we may as well configure this always I guess, even if it's
nonfunctional for many people since they have no permission to any
repos on chrome-internal.
Change-Id: Ia560a64e7771f1438fb1527389a310bbbe951477
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6456192
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
We're switching the GN arg to be default-enabled for local builds.
Bug: 404503040
Change-Id: I710b8fa38bf4ce97d592861b28a49b0bc867b702
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6454372
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Some users just run creds-check which doesn't fix submodules.
Bug: 408501013
Change-Id: Iddb19e922aff8cb265638588595403ac193ead52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6449740
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Otherwise it creates a dependency cycle. This is needed if we want to
recurse into submodules. Maybe this should be refactored more, but
this should be an improvement for now.
Change-Id: I4641e9ce1952bba81f717acbeefd59dd687d87ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6448579
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
Both the internal and community maintained cpplint support regional
nolint annotation NOLINTBEGIN/NOLINTEND.
Bug: 409733462
Change-Id: If738e8f6b8b30e88adec74383fecd8198fe70fbd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6446042
Auto-Submit: Tommy Chiang <ototot@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Tommy Chiang <ototot@google.com>
We're using copybara to sync upstream repo here automatically.
Grant it owners access so more devs can help merge its syncs.
Change-Id: I54acf18c73af6e8c8a670d2761ad60b2a778a20a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6419683
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
_UpdateMirrorIfNotContains populates the mirror if a given rev
isn't found in the mirror, but if this rev is invalid, it's never
fetched at all. Check that we've actually fetched it after
populating the mirror.
Bug: 407864212
Change-Id: Id66695636e749c4f7372aa522ab03ec4ec8feb52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6441962
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>