2544 Commits

Author SHA1 Message Date
Alex Ovsienko
7c837b993a siso: have siso.py use env variables to start the collector.
Bug: b/474306065
Change-Id: I7a443531192a2b20609c43e7ad33e4426a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7414344
Reviewed-by: Junji Watanabe <jwata@google.com>
Commit-Queue: Alex Ovsienko <ovsienko@google.com>
2026-01-08 19:57:05 -08:00
Junji Watanabe
9414627328 Revert "siso: enable autoninja to use env variables instead of flags for collector."
This reverts commit cf876cddd6.

Reason for revert: Speculatively reverting for http://b/474306065.

Original change's description:
> siso: enable autoninja to use env variables instead of flags for collector.
>
> For clients with old siso this will not cause any breakage as we kept the flags, and did not introduce any old ones. Eventually everyone should get their collector running.
>
> The collector startup will be triggered only for clients with enabled logs collection.
>
> Bug: b/455433899
> Change-Id: I962bd551c5a1cc6a5f8904e65d24939b6a6a6964
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7373289
> Commit-Queue: Alex Ovsienko <ovsienko@google.com>
> Reviewed-by: Junji Watanabe <jwata@google.com>

Bug: b/455433899
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: If5d592499c1bbc5ea24c5b2c8ef72aa83d500972
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7407116
Auto-Submit: Junji Watanabe <jwata@google.com>
Commit-Queue: Junji Watanabe <jwata@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2026-01-08 05:52:45 -08:00
Junji Watanabe
6f577a0fc5 Revert "siso: clean up _start_collector function to not modify the env dict."
This reverts commit 02da7602fb.

Reason for revert: Speculatively reverting for http://b/474306065.

Original change's description:
> siso: clean up _start_collector function to not modify the env dict.
>
> Also do not have special status for missing socks file. Clean up socks file before starting the collector.
>
> Bug: b/455433899
> Change-Id: Ib393f00e7a6098fca1b7d1d70f5aa4616a6a6964
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7408697
> Commit-Queue: Alex Ovsienko <ovsienko@google.com>
> Reviewed-by: Junji Watanabe <jwata@google.com>

Bug: b/455433899
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: Ie095f91c72bca65102a96fa33e77b87e79cab9ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7407117
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Junji Watanabe <jwata@google.com>
2026-01-08 05:52:13 -08:00
Alex Ovsienko
02da7602fb siso: clean up _start_collector function to not modify the env dict.
Also do not have special status for missing socks file. Clean up socks file before starting the collector.

Bug: b/455433899
Change-Id: Ib393f00e7a6098fca1b7d1d70f5aa4616a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7408697
Commit-Queue: Alex Ovsienko <ovsienko@google.com>
Reviewed-by: Junji Watanabe <jwata@google.com>
2026-01-08 00:27:33 -08:00
Alex Ovsienko
cf876cddd6 siso: enable autoninja to use env variables instead of flags for collector.
For clients with old siso this will not cause any breakage as we kept the flags, and did not introduce any old ones. Eventually everyone should get their collector running.

The collector startup will be triggered only for clients with enabled logs collection.

Bug: b/455433899
Change-Id: I962bd551c5a1cc6a5f8904e65d24939b6a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7373289
Commit-Queue: Alex Ovsienko <ovsienko@google.com>
Reviewed-by: Junji Watanabe <jwata@google.com>
2026-01-07 22:36:25 -08:00
Gavin Mak
b084cd665f Fix CheckForCommitObjects to check missing gitlink changes
https://crrev.com/c/7234371 made some optimizations to the check
but caused it to start missing changes that modified DEPS but not
the corresponding gitlink.

Fix the check by doing a full tree scan when DEPS is updated.

Bug: 469784282
Change-Id: Ibdcdcb1af5a330e4d9e96daecd28e06bc1436022
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7362007
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Josiah Kiehl <kiehl@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
2026-01-06 10:36:28 -08:00
Gennady Tsitovich
90eb3fe8ba Add --allow-conflicts option to git cl cherry-pick
This CL adds a new --allow-conflicts flag to the `git cl cherry-pick`
command. This allows users to create cherry-pick CLs on Gerrit even if
they result in merge conflicts. The created CL will be in a WIP state,
allowing the user to resolve conflicts in the Gerrit UI or locally.

Additionally, this CL:
- Updates `CMDcherry_pick` to print a regex-friendly warning if the
  created cherry-pick contains conflicts:
  "Warning: Change <URL> contains merge conflicts"
  (needed for the Chrome Cherry Picker)
- Fixes some existing test failures in `gerrit_util_test.py` related to
  authentication mocking in the current environment.
- Adds unit tests for the new flag in both `git_cl_test.py`
  and `gerrit_util_test.py`.

Bug: 439992429
Change-Id: I306e21329688a31a63c9996f1405f5ef5ad07108
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7319362
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gennady Tsitovich <gtsitovich@google.com>
2026-01-06 03:47:38 -08:00
Alex Ovsienko
e04940f5e8 siso: always set the collector address, do not assume default behavior.
Bug: b/455433899
Change-Id: Ib8c0c3041cac5491e70986c0e7a60d386a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7367697
Commit-Queue: Alex Ovsienko <ovsienko@google.com>
Reviewed-by: Junji Watanabe <jwata@google.com>
2026-01-06 00:14:32 -08:00
Alex Ovsienko
daf2602023 siso: introduce flag check for collector by checking its help page.
Bug: b/473530378, b/455433899
Change-Id: I09f53cd181cc3cd516e2fa035616efb06a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7365204
Reviewed-by: Junji Watanabe <jwata@google.com>
Commit-Queue: Alex Ovsienko <ovsienko@google.com>
2026-01-05 22:01:04 -08:00
Alex Ovsienko
6e87d87cd5 siso: add test case where collector returns false to make sure the collector flag does not get appended.
Bug: b/455433899
Change-Id: Id1cb3b6b0eabcbc8997b66be1849beba6a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7367695
Commit-Queue: Alex Ovsienko <ovsienko@google.com>
Reviewed-by: Junji Watanabe <jwata@google.com>
2026-01-05 19:28:07 -08:00
Alex Ovsienko
d80f3ba240 siso: have checks for collector presence in the flags verification.
Bug: b/455433899
Change-Id: Ia366d343e14f10d0cebf32c5a12bedd06a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7387808
Commit-Queue: Junji Watanabe <jwata@google.com>
Auto-Submit: Alex Ovsienko <ovsienko@google.com>
Reviewed-by: Junji Watanabe <jwata@google.com>
2026-01-05 01:43:39 -08:00
Junji Watanabe
0847ade509 Revert "siso: enable collector by default when metrics collection is on."
This reverts commit a4318057fe.

Reason for revert: This seems to break builds with old Siso version.

Original change's description:
> siso: enable collector by default when metrics collection is on.
>
> Bug: b/455433899
> Change-Id: Icdc8f0fb516ed9782f85a935d733b9f26a6a6964
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7366313
> Commit-Queue: Alex Ovsienko <ovsienko@google.com>
> Reviewed-by: Junji Watanabe <jwata@google.com>

Bug: b/455433899
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I819a7271979e122d39a283dc376fc80fc741125b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7394760
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Junji Watanabe <jwata@google.com>
2026-01-04 23:01:08 -08:00
Alex Ovsienko
a4318057fe siso: enable collector by default when metrics collection is on.
Bug: b/455433899
Change-Id: Icdc8f0fb516ed9782f85a935d733b9f26a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7366313
Commit-Queue: Alex Ovsienko <ovsienko@google.com>
Reviewed-by: Junji Watanabe <jwata@google.com>
2026-01-04 17:12:01 -08:00
Allen Li
70179d9d84 gerrit_util: Check user has set usehttppath for reauth
This is in the Git config so it's easy to go unnoticed.

Bug: 462126685
Change-Id: I1ccd21efce580aebfcc8a5a6bef2f7d78e5e75d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7265723
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
2025-12-17 16:58:11 -08:00
Alex Ovsienko
02f1c0f8b7 siso: rewrite the entire siso test to pytest.
With this tests will be easier to read and support.

Also have improved parameterized tests.

The reason why pytest was picked is because as my knowledge goes this is the most up to date and supported unit test framework in Python. The current parameterized tests state is primitive, and the parameterized library was last updated 2 years ago. pytest will help us adopt best practices that later perhaps we could spread to other unit tests in depot_tools.

Bug: 459690822
Change-Id: I67d16b56ff3c4dbd260ea0b07354ef766a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7246550
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Alex Ovsienko <ovsienko@google.com>
Reviewed-by: Junji Watanabe <jwata@google.com>
2025-12-17 16:05:19 -08:00
Allen Li
d3d038869a git_auth: Handle conflicting stale local config (reland)
As we prefer configuring the global config, it's possible to leave
stale local config behind if the user is swapping between emails.

Originally:
https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7213753

Fixed to skip clearing local config when not inside a repo (as that errors).

Bug: 466343784
Change-Id: I8b34d24ba3966c66aeebaf11bd0368dfb4b0da28
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7265721
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
2025-12-16 17:19:31 -08:00
Josiah Kiehl
4244c70855 Handle Windows command line limits in CheckForCommitObjects.
On Windows, the command line has a character limit of 8191. When checking for commit objects in submodules, the `git ls-tree` command can become very long if many files are affected, potentially exceeding this limit.

This change modifies `CheckForCommitObjects` to check the estimated length of the `git ls-tree` command when running on Windows. If the command line with all affected files would exceed the limit, it falls back to using a recursive `ls-tree` (`-r`) instead of listing each file individually. This prevents command line overflow errors on Windows.

Change-Id: I6a340baefee57f5933473add0601a42ff1e61bb6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7254474
Auto-Submit: Josiah Kiehl <kiehl@google.com>
Commit-Queue: Josiah Kiehl <kiehl@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
2025-12-11 18:23:44 -08:00
Alex Ovsienko
ecbf89e1da siso: remove redundant test and consolidate dead then healthy tests.
Bug: b/459690822
Change-Id: I7e3a342d3e5be7b5802275cdce0db2ec6a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7244732
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
Reviewed-by: Philipp Wollermann <philwo@google.com>
Commit-Queue: Alex Ovsienko <ovsienko@google.com>
2025-12-09 22:48:30 -08:00
Alex Ovsienko
a6671ce6c7 siso: consolidate collector kill tests for posix and windows.
Bug: b/459690822
Change-Id: If23c54307a76ecba19e856da145e66736a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7244731
Commit-Queue: Alex Ovsienko <ovsienko@google.com>
Reviewed-by: Philipp Wollermann <philwo@google.com>
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
2025-12-09 22:19:50 -08:00
Alex Ovsienko
ff6558d2ee siso: remove usage of platform library from siso.py
Bug: b/455433899
Change-Id: Iff65cbfd920c93114b784bce8ded91ec6a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7237760
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
Reviewed-by: Philipp Wollermann <philwo@google.com>
Commit-Queue: Philipp Wollermann <philwo@google.com>
2025-12-09 21:48:33 -08:00
Josiah Kiehl
7c09ebfd12 Optimize CheckForCommitObjects by batching git ls-tree operations
Significantly reduces the execution time of presubmit checks by
optimizing CheckForCommitObjects.

For CLs with fewer than 1000 affected files, run `git ls-tree` only on
specific files instead of scanning the full tree. This yields a ~70x
speedup (~0.97s -> ~0.01s) for typical CLs.

Change-Id: Ia8b89dbb14a5129ba79944282deba52a3558bdf2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7234371
Commit-Queue: Josiah Kiehl <kiehl@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
2025-12-09 15:07:14 -08:00
Josiah Kiehl
b48cbb3e60 Optimize CheckForCommitObjects presubmit check
This CL optimizes CheckForCommitObjects in two ways:
- Fast Path: If the raw `git ls-tree` output does not contain `160000` (gitlink mode), return early. This avoids parsing entirely for repositories without submodules at the cost of about 3ms.
- Iterative Parsing: For repositories with submodules, use an iterative find loop to locate gitlink entries instead of splitting the entire tree content.

On the Chromium repo:
- Speed: The parsing step is ~7.7x faster (0.04s vs 0.30s).
- Memory: Saves ~78 MB of memory per run by avoiding the creation of ~300,000 string objects during the split.

I also added tests now that it's more than a simple loop.

Change-Id: I903effc50aaedb9130772491ad38385b22477d58
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7231149
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Josiah Kiehl <kiehl@google.com>
2025-12-09 10:55:42 -08:00
Josiah Kiehl
82130f468a Speed up presubmit by caching code-owners check
Currently, presubmit queries the gerrit server every run to check if the
code-owners plugin is enabled.

This CL caches that result in a /tmp file per repository.

This saves as much as 1.5s per `git cl presubmit`.

Change-Id: I1a3631074d1bcbb1a254caa6654fd8434f069aa2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7227749
Commit-Queue: Josiah Kiehl <kiehl@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
2025-12-09 10:50:31 -08:00
Lauren Minchin
f520a9305e Add canned check for AyeAye analyzers
Bug:b/464253715
Change-Id: I86bff67eac3aeae00cac9798cb9237e7c5364b10
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7237916
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Lauren Minchin <lminchin@google.com>
2025-12-09 10:46:52 -08:00
Alex Ovsienko
6cd31a3b57 siso: have siso.py control if collector creates socket file.
Bug: b/455433899
Change-Id: Ic02cd97ef3db59263859eeab5cd70f986a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7231248
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
Commit-Queue: Alex Ovsienko <ovsienko@google.com>
2025-12-09 01:16:10 -08:00
Alex Ovsienko
fc502860ed siso: integrate collector call.
Bug: b/455433899

Change-Id: Id72ff71e1b4269b828658c90461ba4b46a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7205886
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
Commit-Queue: Alex Ovsienko <ovsienko@google.com>
2025-12-09 01:01:29 -08:00
Alex Ovsienko
ac1b095b09 siso: do not restart the collector if projects don't match.
The correct project is set at runtime by siso.

Bug: b/455433899
Change-Id: Ibe1d348729e53425f27812e83a5c7f466a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7234199
Commit-Queue: Alex Ovsienko <ovsienko@google.com>
Reviewed-by: Junji Watanabe <jwata@google.com>
2025-12-07 20:39:43 -08:00
Alex Ovsienko
f8cc59a94b siso: create _start_collector function.
It will run only when collector subcommand is present and attempt at handling the start and restart when needed.

Bug: b/455433899
Change-Id: I9a8b8001aec29b6ca3db61ec6150deb86a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7183447
Reviewed-by: Junji Watanabe <jwata@google.com>
Commit-Queue: Alex Ovsienko <ovsienko@google.com>
2025-12-07 15:57:33 -08:00
jj
80d6ca1b1a Replace deprecated ast types with ast.Constant
ast.Str et al. have been deprecated since Py3.8 and have been
completely removed in 3.14. Replace their usage with ast.Constant.

This change should not have any functional impact, since
according to [1]:
> Changed in version 3.8: Class ast.Constant is now used for
> all constants.
> Deprecated since version 3.8: Old classes ast.Num, ast.Str,
> [...]  instantiating them will return an instance of a
> different class.

[1] https://docs.python.org/3/library/ast.html

Bug: 40283283
Change-Id: I0ed8ef3910f921483bff118976f516c5a935e0fc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7228507
Reviewed-by: Gavin Mak <gavinmak@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: jj <jj@chromium.org>
2025-12-05 11:47:42 -08:00
Yiwei Zhang
e0a877ed8f Revert "git_auth: Handle conflicting stale local config"
This reverts commit e96cff71c9.

Reason for revert: causing https://issues.chromium.org/466343784

Original change's description:
> git_auth: Handle conflicting stale local config
>
> As we prefer configuring the global config, it's possible to leave
> stale local config behind if the user is swapping between emails.
>
> Change-Id: I86e2cda33a90b603e52d525fcb564fb0a5a68eab
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7213753
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Allen Li <ayatane@chromium.org>

No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: Iec8ce86a6d17b26e5cc3940a38c6510ad3f855be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7231141
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2025-12-05 09:56:59 -08:00
Alex Ovsienko
f2ac99f082 siso: make sure we don't try to kill process 0 if it gets returned.
Bug: b/455433899
Change-Id: I8d4e6df5a374e97c0d790fe608964c6f6a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7220270
Auto-Submit: Alex Ovsienko <ovsienko@google.com>
Commit-Queue: Alex Ovsienko <ovsienko@google.com>
Commit-Queue: Junji Watanabe <jwata@google.com>
Reviewed-by: Junji Watanabe <jwata@google.com>
2025-12-04 21:36:50 -08:00
Allen Li
e96cff71c9 git_auth: Handle conflicting stale local config
As we prefer configuring the global config, it's possible to leave
stale local config behind if the user is swapping between emails.

Change-Id: I86e2cda33a90b603e52d525fcb564fb0a5a68eab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7213753
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
2025-12-04 15:15:29 -08:00
Josiah Kiehl
4b799c1e8d Fix presubmit feedback message unit test for cog environments.
Add a test case to verify the presubmit feedback message when running in
a cog environment.

Change-Id: I82baf94f53a53108abb32069d3dcf714222a3353
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7229612
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Josiah Kiehl <kiehl@google.com>
2025-12-04 14:39:20 -08:00
Peter Wen
04f3706a63 git_cl.py: Process comments as threads
Refactor GetCommentsSummary to group individual comments into threads. A
thread is considered unresolved if and only if its last comment is
unresolved.

This fixes a bug where a resolved thread (one that had been replied to
and the resolved box checked in the reply) would still appear with the
--unresolved flag, because the initial comment in the thread is
permanently marked as unresolved.

This change also introduces a CommentInfo dataclass to improve
ergonomics for handling comment data from the Gerrit API.

The display of comments have not been made thread-aware to reduce the
scope of this change.

R=agrieve@chromium.org

Bug: 463411949
Fixed: 463411949
Change-Id: I966f011140ee3874b54d8afbbe00caed7bbe14eb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7200823
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Auto-Submit: Peter Wen <wnwen@chromium.org>
Commit-Queue: Peter Wen <wnwen@chromium.org>
2025-12-03 06:16:04 -08:00
Allen Li
1acf6d271e git_auth: Configure both variations of Gerrit hosts
ChromeOS sometimes uses -review URLs, so we should support both

Bug: 419182970
Change-Id: I9a3836f5544a8422ccda8ded6e9d88d5a10edda2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7173365
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
2025-12-02 16:35:21 -08:00
Ben Joyce
a99ce048b9 Add structured test id upload support to resuldb uploader
Not sure how to roll this to src after landing.
This is similar to changes for structured-test-ids in changes such as:
https://source.chromium.org/chromium/chromium/src/+/main:testing/scripts/common.py;l=203?q=common.py&ss=chromium

Bug:418015486
Change-Id: I742a6a9e7b04735e31aa1b893a1cbffc9d6e3188
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7173696
Commit-Queue: Benjamin Joyce (Ben) <bjoyce@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
2025-12-02 14:08:33 -08:00
Alex Ovsienko
db99cc40f5 siso: do not have _is_subcommand_present print to stdout.
Bug: b/455433899
Change-Id: I20a840669538c1a48a645226b949b37f6a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7205887
Reviewed-by: Junji Watanabe <jwata@google.com>
Commit-Queue: Alex Ovsienko <ovsienko@google.com>
2025-12-01 17:09:47 -08:00
Alex Ovsienko
f32e176f94 Add an extra check that gcert is installed on machine to make sure that the user is googler.
Bug: b/462556449
Change-Id: I2afff69ee202659e23d822c59dd4cc166a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7201883
Reviewed-by: Junji Watanabe <jwata@google.com>
Commit-Queue: Alex Ovsienko <ovsienko@google.com>
2025-12-01 17:01:18 -08:00
Alex Ovsienko
4d6030e6b1 siso: create function to kill potentially running collector.
It checks running processed for what ports they occupy and kills the first process that occupies otlp_health_port that is known from config and quits.

Bug: b/455433899

Change-Id: Ib588be4c44021e55c67f1601040ac72a6a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7183397
Reviewed-by: Junji Watanabe <jwata@google.com>
Commit-Queue: Alex Ovsienko <ovsienko@google.com>
2025-12-01 16:53:57 -08:00
Adam Norberg
3d401c263f Caffeinate fetches on Mac.
Since fetches involve multiple subprocess calls, any of which can be
slow, the per-subprocess caffeination strategy does not seem suitable --
the Mac might sleep as soon as the wake lock is dropped, before it
starts a new one. This instead implements a context manager to allow
caffeinating a scope.

To allow flag control, caffeinate.scope takes an argument that decides
whether or not it should actually do anything useful; it looks silly,
but the alternative is to interfere with flag parsing more or to require
users to write separate codepaths to decide whether to enter the context
manager scope or not; the "use the context manager in a mode where it
does not do anything" prevents this.

Bug: 462507017
Change-Id: Icc5bb9cadda30b5a120f112b10bf96ffd3b6550f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7183647
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Adam Norberg <norberg@google.com>
2025-11-21 14:01:25 -08:00
Fumitoshi Ukai
a40c63a40b siso: fix GOOGLE_API_USE_CLIENT_CERTIFICATE
GOOGLE_API_USE_CLIENT_CERTIFICATE=false was not passed
to siso process.

Change-Id: I44e1d63c7fbf8184822d9d888495b4818b511eac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7171141
Auto-Submit: Fumitoshi Ukai <ukai@google.com>
Commit-Queue: Alex Ovsienko <ovsienko@google.com>
Reviewed-by: Alex Ovsienko <ovsienko@google.com>
2025-11-18 23:49:18 -08:00
Allen Li
02f950a7cd git_auth: Add test for url rewrite override case
To prevent possible future regressios

Change-Id: I873be512b621f57f1dd9f54a68d093cd65228bf0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7164718
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
2025-11-18 15:43:06 -08:00
Scott Lee
039035332b bug fix for diff hunk parsing
The diff hunk can omit the number of lines after the line position.
For example, the following hunks are all valid
- @@ -1,2 +1,3 @@
- @@ -1 +1,3 @@
- @@ -1,2 +1 @@
- @@ -1 +1 @@

However, the existing regex assumes that the number of lines is always
given. It wasn't a problem before crrev.com/c/6952890, because -U3 was
applied always. However, since it changed the context lines to -U0,
git diff started generating hunks without the number of lines, if
a given changed section contains only a single line.

This CL fixes the regex.

Bug: 453641840
Change-Id: I67f680bc1d8fa046e373b065e8ccbb6ce652eb3f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7158599
Auto-Submit: Scott Lee <ddoman@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Scott Lee <ddoman@chromium.org>
2025-11-17 09:06:06 -08:00
Alex Ovsienko
926832f6db siso: extract command line args handling into _process_args.
Add tests for _process_args to make sure all flags operate as expected.

Bug: b/459690822
Change-Id: I98086cb0a274420f440b2ac3490473566a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7161336
Commit-Queue: Alex Ovsienko <ovsienko@google.com>
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
2025-11-16 23:38:15 -08:00
Alex Ovsienko
ca5576a48f siso: cover apply_metrics_labels and apply_telemetry_flags functions with tests.
Bug: b/459690822

Change-Id: Iccb5b83e8572afa8d6a66252fc69cf766a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7141140
Commit-Queue: Alex Ovsienko <ovsienko@google.com>
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
2025-11-16 21:57:17 -08:00
Alex Ovsienko
c527a62fe0 siso: create simple function to check if subcommand is present is siso using help.
That will help with starting collector from subcommand when clients may have older siso versions installed.

Bug: b/455433899

Change-Id: I5949b46017619a1717ef87781d8430b56a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7155815
Commit-Queue: Alex Ovsienko <ovsienko@google.com>
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
2025-11-16 19:03:44 -08:00
Jiewei Qian
240cd02c29 reauth: implement GitCreds credential pre-flight checks
This CL implements ensure_authenticated() for GitCredsAuthenticator, and
adds ReAuth support.

This check performs best-effort credential checks before performing
expensive operations such as presubmit hooks. This allows us to fail fast when an ReAuth token is missing for a contributor subject to
ReAuth requirements.

If you suspect this CL has caused a breakage on CL upload, please
revert.

Bug: 451651615
Change-Id: I42f3ffe3c830ed7bd2322f6cf2ad8adbba7e7251
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7036772
Reviewed-by: Allen Li <ayatane@chromium.org>
Reviewed-by: Scott Lee <ddoman@chromium.org>
Commit-Queue: Jiewei Qian <qjw@chromium.org>
2025-11-04 11:38:19 -08:00
Jiewei Qian
5567ad1ea0 gerrit_util: add ReAuth support to ensure_authenticated
This CL makes it possible for ensure_authenticated to check whether
the current credential would satisfy ReAuth requirement.

Right now, only GitCredsAuthenticator performs additional ReAuth
check. For other Authenticator, either ReAuth is not relevant
(e.g. SSO), or not supported or implied (e.g. .gitcookies).

This CL does nothing on its own, because ensure_autheticated with
ReAuth is opt-in. Subsequent CL will update callsites to pass in
ReAuthContext to make the check effective.

Bug: 451651615
Change-Id: Idb1e70c52aaa844e672331fad8d462a2a7577d45
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7104363
Commit-Queue: Jiewei Qian <qjw@chromium.org>
Reviewed-by: Scott Lee <ddoman@chromium.org>
Reviewed-by: Allen Li <ayatane@chromium.org>
2025-11-04 11:21:10 -08:00
Jiewei Qian
1faea18c64 git-cl-test: rename auth parameter to creds
This avoids a import name clash in future CLs.

Bug: 451651615
Change-Id: Ie35cbe58f36ec98b33c48a70e61a2678a9ce52db
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7104382
Auto-Submit: Jiewei Qian <qjw@chromium.org>
Reviewed-by: Allen Li <ayatane@chromium.org>
Commit-Queue: Scott Lee <ddoman@chromium.org>
Reviewed-by: Scott Lee <ddoman@chromium.org>
2025-11-04 11:05:03 -08:00
Milad Fa
a4fa14bf0d remove ppc and s390 from the host_arch list
We only support ppc64 and s390x.

Change-Id: I1ec46bbfc0bdd266b84336e5af46b0503efd4751
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7100932
Auto-Submit: Milad Farazmand <mfarazma@ibm.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Reviewed-by: Brian Ryner <bryner@google.com>
2025-11-03 09:28:07 -08:00